pull-in func-params branch

This commit is contained in:
BVK Chaitanya 2010-06-09 11:34:01 +05:30
commit 3db1c9eee4
181 changed files with 7238 additions and 14702 deletions

615
ChangeLog
View file

@ -1,3 +1,616 @@
2010-05-19 BVK Chaitanya <bvk.groups@gmail.com>
Fix grub-mkrescue usage unit testing.
* tests/util/grub-shell.in: Use --grub-mkimage with grub-mkrescue.
2010-05-18 Christian Franke <franke@computer.org>
* util/grub.d/10_windows.in: Use path names instead of
drive letters to prevent warning from Cygwin 1.7.
Add drivemap command to menuentry if needed.
2010-05-18 Justus Winter <4winter@informatik.uni-hamburg.de>
* util/grub.d/10_hurd.in: Include all gnumach* kernels, not only
gnumach and gnumach.gz.
2010-05-18 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/i18n.h (gettext): Inline instead of using #define.
(grub_gettext): Likewise.
(_): Likewise.
2010-05-18 Vladimir Serbinenko <phcoder@gmail.com>
* Makefile.in (CPPFLAGS): Replace -DGRUB_LIBDIR with
-DGRUB_PKGLIBROOTDIR= and prepend @PACKAGE_TARNAME@. All users updated.
* util/grub-mkimage.c (image_targets): Add i386-multiboot.
(main): Add a slash after pkglibdirroot.
2010-05-18 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-install.in: Add missing "in" keyword.
2010-05-18 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkrescue.in: Remove -O i386-pc duplication.
Reported by: Seth Goldberg.
2010-05-18 Vladimir Serbinenko <phcoder@gmail.com>
* po/POTFILES: Rename util/grub-mkrawimage.c to util/grub-mkimage.c.
2010-05-18 Colin Watson <cjwatson@ubuntu.com>
* configure.ac: Check for Linux device-mapper support.
* util/hostdisk.c (device_is_mapped): New function.
(find_partition_start): New function, partly broken out from
linux_find_partition and grub_util_biosdisk_get_grub_dev but with
device-mapper support added.
(linux_find_partition): Use find_partition_start.
(convert_system_partition_to_system_disk): Add `st' argument.
Support Linux /dev/mapper/* devices if device-mapper support is
available; only DM-RAID devices are understood at present.
(find_system_device): Add `st' argument. Pass it to
convert_system_partition_to_system_disk.
(grub_util_biosdisk_get_grub_dev): Pass stat result to
find_system_device and convert_system_partition_to_system_disk. Use
find_partition_start.
* conf/common.rmk (grub_mkdevicemap_SOURCES): Add kern/env.c,
kern/err.c, kern/list.c, kern/misc.c, and kern/emu/mm.c.
* util/deviceiter.c [__linux__]: Define MINOR.
(grub_util_iterate_devices): Add support for DM-RAID disk devices.
* util/mkdevicemap.c (grub_putchar): New function.
(grub_getkey): New function.
(grub_refresh): New function.
(main): Set debug=all if -v -v is used.
2010-05-18 Colin Watson <cjwatson@ubuntu.com>
Fix build with non-GNU libcs.
* util/misc.c (canonicalize_file_name): Move to ...
* kern/emu/misc.c (canonicalize_file_name): ... here. Needed by
grub_make_system_path_relative_to_its_root.
2010-05-18 Colin Watson <cjwatson@ubuntu.com>
* util/grub-mkrescue.in: Sync up with grub-install in terms of how
we handle finding grub-mkimage. Default to finding grub-mkimage in
${bindir} with program_transform_name applied, and provide a
--grub-mkimage option to override this.
2010-05-17 Vladimir Serbinenko <phcoder@gmail.com>
Remove grub-mkisofs.
* conf/common.rmk (bin_UTILITIES): Remove grub-mkisofs.
(grub_mkisofs_SOURCES): Removed.
(grub_mkisofs_CFLAGS): Removed.
* util/mkisofs/defaults.h: Removed.
* util/mkisofs/eltorito.c: Likewise.
* util/mkisofs/exclude.h: Likewise.
* util/mkisofs/hash.c: Likewise.
* util/mkisofs/include/: Likewise.
* util/mkisofs/include/fctldefs.h: Likewise.
* util/mkisofs/include/mconfig.h: Likewise.
* util/mkisofs/include/prototyp.h: Likewise.
* util/mkisofs/include/statdefs.h: Likewise.
* util/mkisofs/iso9660.h: Likewise.
* util/mkisofs/joliet.c: Likewise.
* util/mkisofs/match.c: Likewise.
* util/mkisofs/match.h: Likewise.
* util/mkisofs/mkisofs.c: Likewise.
* util/mkisofs/mkisofs.h: Likewise.
* util/mkisofs/msdos_partition.h: Likewise.
* util/mkisofs/multi.c: Likewise.
* util/mkisofs/name.c: Likewise.
* util/mkisofs/rock.c: Likewise.
* util/mkisofs/tree.c: Likewise.
* util/mkisofs/write.c: Likewise.
2010-05-17 Vladimir Serbinenko <phcoder@gmail.com>
Unify grub-mkimage accross platforms.
* Makefile.in (CPPFLAGS): Set GRUB_LIBDIR to $(libdir).
* conf/common.rmk (bin_UTILITIES): Removed grub-mkelfimage.
(grub_mkelfimage_SOURCES): Removed.
(util/elf/grub-mkimage.c_DEPENDENCIES): Renamed to ..
(util/grub-mkimage.c_DEPENDENCIES): .. this.
(bin_UTILITIES): Add grub-mkimage.
(grub_mkimage_SOURCES): New variable.
(kernel_img_HEADERS): Remove machine/kernel.h.
* conf/i386-pc.rmk (pkglib_IMAGES): Remove kernel.img.
(pkglib_PROGRAMS): Add kernel.img.
(kernel_img_HEADERS): Add machine/kernel.h.
(kernel_img_FORMAT): Removed.
(bin_UTILITIES): Remove grub-mkimage.
(grub_mkimage_SOURCES): Removed.
(grub_mkimage_CFLAGS): Likewise.
(util/grub-mkrawimage.c_DEPENDENCIES): Likewise.
* conf/i386-qemu.rmk (pkglib_IMAGES): Remove kernel.img.
(pkglib_PROGRAMS): Add kernel.img.
(bin_UTILITIES): Remove grub-mkimage.
(grub_mkimage_SOURCES): Removed.
(grub_mkimage_CFLAGS): Likewise.
(util/grub-mkrawimage.c_DEPENDENCIES): Likewise.
* conf/mips-qemu-mips.rmk (pkglib_IMAGES): Remove kernel.img.
(pkglib_PROGRAMS): Add kernel.img.
* conf/mips-yeeloong.rmk (pkglib_IMAGES): Remove kernel.img.
(pkglib_PROGRAMS): Add kernel.img.
* conf/mips.rmk (bin_UTILITIES): Remove grub-mkimage.
(grub_mkimage_SOURCES): Removed.
(grub_mkimage_CFLAGS): Likewise.
(util/grub-mkrawimage.c_DEPENDENCIES): Likewise.
* conf/sparc64-ieee1275.rmk (pkglib_IMAGES): Remove kernel.img.
(pkglib_PROGRAMS): Add kernel.img.
(bin_UTILITIES): Remove grub-mkimage.
(grub_mkimage_SOURCES): Removed.
(grub_mkimage_CFLAGS): Likewise.
(util/grub-mkrawimage.c_DEPENDENCIES): Likewise.
* conf/x86-efi.rmk (bin_UTILITIES): Remove grub-mkimage.
(grub_mkimage_SOURCES): Removed.
(grub_mkimage_CFLAGS): Likewise.
(util/grub-mkrawimage.c_DEPENDENCIES): Likewise.
* configure.ac (machine_CFLAGS): Add "-DMACHINE".
* include/grub/efi/pe32.h (grub_pe32_optional_header): Split into ...
(grub_pe32_optional_header): ... this.
(grub_pe64_optional_header): ... and this. All users updated.
(GRUB_PE32_PE32_MAGIC): Split into ..
(GRUB_PE32_PE32_MAGIC): .. this.
(GRUB_PE32_PE64_MAGIC): .. and this.
(GRUB_PE32_SIGNATURE_SIZE): New definition.
* include/grub/elf.h (PT_GNU_STACK): New definition.
* include/grub/i386/coreboot/kernel.h: Merged into include/grub/offsets.h. All users updated.
* include/grub/i386/efi/kernel.h: Likewise.
* include/grub/i386/kernel.h: Likewise.
* include/grub/i386/pc/kernel.h: Likewise.
* include/grub/i386/qemu/boot.h: Likewise.
* include/grub/mips/kernel.h: Likewise.
* include/grub/mips/qemu-mips/kernel.h: Likewise.
* include/grub/powerpc/ieee1275/kernel.h: Likewise.
* include/grub/powerpc/kernel.h: Likewise.
* include/grub/sparc64/ieee1275/boot.h: Likewise.
* include/grub/sparc64/ieee1275/kernel.h: Likewise.
* include/grub/sparc64/kernel.h: Likewise.
* include/grub/x86_64/efi/kernel.h: Likewise.
* include/grub/x86_64/kernel.h: Likewise.
* include/grub/offsets.h: New file.
* include/grub/kernel.h (grub_module_info): Split into ...
(grub_module_info32): ... this.
(grub_module_info64): ... and this.
* include/grub/i386/pc/boot.h (GRUB_BOOT_MACHINE_KERNEL_SEG): Moved from here ...
* include/grub/offsets.h (GRUB_BOOT_I386_PC_KERNEL_SEG): ... here.
(grub_boot_blocklist): Moved from here ...
* include/grub/offsets.h (grub_pc_bios_boot_blocklist): ... here.
* include/grub/i386/pc/memory.h (GRUB_MEMORY_MACHINE_UPPER): Moved from here.
* include/grub/offsets.h (GRUB_MEMORY_I386_PC_UPPER): .. here.
* include/grub/types.h (grub_target_to_host16): Removed.
(grub_target_to_host32): Likewise.
(grub_target_to_host64): Likewise.
(grub_host_to_target16): Likewise.
(grub_host_to_target32): Likewise.
(grub_host_to_target64): Likewise.
(grub_host_to_target_addr): Likewise.
Support grub-mkrescue for efi, coreboot and qemu.
* conf/x86-efi.rmk (bin_SCRIPTS): Add grub-mkrescue.
* kern/efi/init.c (grub_efi_set_prefix): Handle baked in prefix.
* util/elf/grub-mkimage.c: Merged into util/grub-mkimage.c.
* util/grub-mkrawimage.c: Moved from here ...
* util/grub-mkimage.c: ... here. All users updated.
(ALIGN_ADDR): Use image_target.
(TARGET_NO_FIELD): New const.
(image_target_desc): New type.
(image_targets): New array.
(grub_target_to_host64): Use image_target.
(grub_target_to_host32): Likewise.
(grub_target_to_host16): Likewise.
(grub_host_to_target64): Likewise.
(grub_host_to_target32): Likewise.
(grub_host_to_target16): Likewise.
(grub_host_to_target_addr): Likewise.
(generate_image): Handle multiimage.
(main): Require -O parameter. All users updated.
* util/grub-mkimagexx.c: New file. Based on util/grub-mkrawimage.c and
util/efi/grub-mkimage.c
* util/grub-mkrescue.in: Handle coreboot, efi and qemu.
New option --rom-directory.
Use xorriso.
* util/i386/efi/grub-mkimage.c: Removed.
* util/i386/pc/grub-setup.c (grub_target_to_host16): New definition.
(grub_target_to_host32): Likewise.
(grub_target_to_host64): Likewise.
(grub_host_to_target16): Likewise.
(grub_host_to_target32): Likewise.
(grub_host_to_target64): Likewise.
* util/sparc64/ieee1275/grub-setup.c (grub_target_to_host16): New definition.
(grub_target_to_host32): Likewise.
(grub_target_to_host64): Likewise.
(grub_host_to_target16): Likewise.
(grub_host_to_target32): Likewise.
(grub_host_to_target64): Likewise.
2010-05-17 BVK Chaitanya <bvk.groups@gmail.com>
Source tree is reorganized for emu build.
* include/grub/util/console.h: Move from here...
* include/grub/emu/console.h: ...to here.
* include/grub/util/getroot.h: Move from here...
* include/grub/emu/getroot.h: ...to here.
* include/grub/util/hostdisk.h: Move from here...
* include/grub/emu/hostdisk.h: ...to here.
* util/console.c: Move from here...
* kern/emu/console.c: ...to here.
* util/getroot.c: Move from here...
* kern/emu/getroot.c: ...to here.
* util/grub-emu.c: Move from here...
* kern/emu/main.c: ...to here.
* util/hostdisk.c: Move from here...
* kern/emu/hostdisk.c: ...to here.
* util/hostfs.c: Move from here...
* kern/emu/hostfs.c: ...to here.
* util/mm.c: Move from here...
* kern/emu/mm.c: ...to here.
* util/pci.c: Move from here...
* bus/emu/pci.c: ...to here.
* util/sdl.c: Move from here...
* video/emu/sdl.c: ...to here.
* util/time.c: Move from here...
* kern/emu/time.c: ...to here.
* util/usb.c: Move from here...
* bus/usb/emu/usb.c: ...to here.
* include/grub/emu/misc.h: New header for grub-emu functions.
* kern/emu/misc.c: grub-emu functions separated from util/misc.c
* conf/any-emu.rmk: Rule updates for above renames.
* conf/common.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
* conf/i386-qemu.rmk: Likewise.
* conf/mips.rmk: Likewise.
* conf/sparc64-ieee1275.rmk: Likewise.
* conf/x86-efi.rmk: Likewise.
* disk/lvm.h: #include updates for above renames.
* util/grub-mkrelpath.c: Likewise.
* util/grub-probe.c: Likewise.
* util/i386/pc/grub-setup.c: Likewise.
* util/sparc64/ieee1275/grub-setup.c: Likewise.
* kern/emu/console.c: Likewise.
* kern/emu/getroot.c: Likewise.
* kern/emu/hostdisk.c: Likewise.
* kern/emu/main.c: Likewise. (was grub-emu.c earlier)
* include/grub/dl.h: Remove grub_dl_{ref,unref}.
* include/grub/util/misc.h: Move grub-emu functions to emu/misc.h.
* kern/dl.c: Handle null mod in grub_dl_{ref,unref}.
* util/misc.c: Remove grub-emu functions.
2010-05-13 Vladimir Serbinenko <phcoder@gmail.com>
Fix gfxmenu crash.
Reported by: Thorsten Grützmacher.
* gfxmenu/gui_circular_progress.c (circprog_destroy): Unregister
timeout hook.
(circprog_set_property): Register and unregister timeout hook.
* gfxmenu/gui_label.c (grub_gui_label): New fields template and value.
(label_destroy): Free template. and unregister hook.
(label_set_state): New function.
(label_set_property): Handle templates and hooks.
* gfxmenu/gui_progress_bar.c (progress_bar_destroy): Unregister
timeout hook.
(progress_bar_set_property): Register and unregister timeout hook.
* gfxmenu/view.c (TIMEOUT_COMPONENT_ID): Move from here ...
* include/grub/gui.h (GRUB_GFXMENU_TIMEOUT_COMPONENT_ID): ...to here
* gfxmenu/view.c (grub_gfxmenu_timeout_notifications): New variable.
(update_timeout_visit): Removed.
(update_timeouts): New function.
(redraw_timeouts): Likewise.
(grub_gfxmenu_print_timeout): Use update_timeouts and redraw_timeouts.
(grub_gfxmenu_clear_timeout): Likewise.
* include/grub/gui.h (grub_gfxmenu_set_state_t): New type.
(grub_gfxmenu_timeout_notify): Likewise.
(grub_gfxmenu_timeout_notifications): New external variable.
(grub_gfxmenu_timeout_register): New function.
(grub_gfxmenu_timeout_unregister): Likewise.
2010-05-09 Vladimir Serbinenko <phcoder@gmail.com>
Transform (broken) vga terminal into (working) vga video driver.
* conf/i386-pc.rmk (vga_mod_SOURCES): Change term/i386/pc/vga.c to
video/i386/pc/vga.c.
* include/grub/video.h (grub_video_driver_id):
Add GRUB_VIDEO_DRIVER_VGA.
* term/i386/pc/vga.c: Renamed to ...
* video/i386/pc/vga.c: ...this
(DEBUG_VGA): Removed.
(CHAR_WIDTH): Likewise.
(CHAR_HEIGHT): Likewise.
(TEXT_WIDTH): Likewise.
(TEXT_HEIGHT): Likewise.
(DEFAULT_FG_COLOR): Likewise.
(DEFAULT_BG_COLOR): Likewise.
(colored_char): Likewise.
(xpos): Likewise.
(ypos): Likewise.
(cursor_state): Likewise.
(fg_color): Likewise.
(bg_color): Likewise.
(text_buf): Likewise.
(page): Likewise.
(font): Likewise.
(framebuffer): New variable.
(set_read_map): Disabled.
(setup): New variable.
(is_target): Likewise.
(grub_vga_mod_init): Likewise.
(grub_vga_mod_fini): Likewise.
(check_vga_mem): Likewise.
(write_char): Likewise.
(write_cursor): Likewise.
(scroll_up): Likewise.
(grub_vga_putchar): Likewise.
(grub_vga_getcharwidth): Likewise.
(grub_vga_getwh): Likewise.
(grub_vga_getxy): Likewise.
(grub_vga_gotoxy): Likewise.
(grub_vga_cls): Likewise.
(grub_vga_setcolorstate): Likewise.
(grub_vga_setcursor): Likewise.
(grub_video_vga_init): New function.
(grub_video_vga_setup): Likewise.
(grub_video_vga_fini): Likewise.
(update_target): Likewise.
(grub_video_vga_blit_bitmap): Likewise.
(grub_video_vga_blit_render_target): Likewise.
(grub_video_vga_set_active_render_target): Likewise.
(grub_video_vga_get_active_render_target): Likewise.
(grub_video_vga_swap_buffers): Likewise.
(grub_video_vga_set_palette): Likewise.
(grub_video_vga_get_info_and_fini): Likewise.
(grub_vga_term): Removed.
(grub_video_vga_adapter): New variable.
(GRUB_MOD_INIT): Register a video driver instead of terminal.
(GRUB_MOD_FINI): Unrefister a video driver instead of terminal.
2010-05-05 Vladimir Serbinenko <phcoder@gmail.com>
* video/readers/jpeg.c: Indented.
2010-05-05 Vladimir Serbinenko <phcoder@gmail.com>
Various jpeg cleanups.
* video/readers/jpeg.c (grub_jpeg_get_huff_code): Use ARRAY_SIZE.
(grub_jpeg_decode_quan_table): Use sizeof.
(grub_jpeg_decode_du): Use ARRAY_SIZE.
2010-05-05 Peter Hurley <No e-mail available> (tiny change)
* video/readers/jpeg.c (grub_jpeg_decode_huff_table): Loop over all
tables. Ignore non-last ac bit.
(grub_jpeg_decode_quan_table): Likewise.
2010-05-05 Vladimir Serbinenko <phcoder@gmail.com>
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): New value
GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM.
* kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set
GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM on qemu.
* kern/ieee1275/init.c (grub_claim_heap): Don0t allocate below
1.5MiB if GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM is set.
2010-05-05 Vladimir Serbinenko <phcoder@gmail.com>
* term/ieee1275/ofconsole.c (grub_ofconsole_getkey): Fix off-by-one
error.
2010-05-05 Vladimir Serbinenko <phcoder@gmail.com>
* term/ieee1275/ofconsole.c (grub_ofconsole_readkey): Support C0 code.
2010-05-03 Vladimir Serbinenko <phcoder@gmail.com>
* commands/parttool.c (grub_cmd_parttool): Fix #if !GRUB_NO_MODULES
condition.
2010-05-03 Vladimir Serbinenko <phcoder@gmail.com>
* kern/mm.c (grub_real_malloc): Put magic and size assignment in common
part.
2010-05-03 Vladimir Serbinenko <phcoder@gmail.com>
* kern/mm.c (grub_mm_init_region): Check for region size after aligning
pointers.
2010-05-03 Vladimir Serbinenko <phcoder@gmail.com>
* kern/mm.c (grub_real_malloc): Fix size calculation when extra == 0.
2010-05-01 Christian Franke <franke@computer.org>
* util/grub-mkconfig_lib.in (make_system_path_relative_to_its_root):
Remove broken Cygwin path conversion.
* util/misc.c: [__CYGWIN__] Add include and define.
[__CYGWIN__] (get_win32_path): Copy function from getroot.c, modify
for Cygwin 1.7.
(make_system_path_relative_to_its_root): Simplify loop, replace early
return by break.
[__CYGWIN__] Add conversion to win32 path.
Include "/" case in trailing slash removal.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* kern/main.c (grub_load_config): Fix copy-pasted comment.
Reported by: Seth Goldberg
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* commands/help.c (grub_cmd_help): Fix a typo.
Reported by: Seth Goldberg
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* commands/hashsum.c (GRUB_MOD_INIT): Remove duplication of command
name and add N_.
* commands/i386/pc/drivemap.c (GRUB_MOD_INIT): Likewise.
* commands/iorw.c (GRUB_MOD_INIT): Likewise.
* commands/password_pbkdf2.c (GRUB_MOD_INIT): Likewise.
* commands/regexp.c (GRUB_MOD_INIT): Likewise.
* commands/setpci.c (GRUB_MOD_INIT): Likewise.
* commands/terminal.c (GRUB_MOD_INIT): Likewise.
* efiemu/main.c (GRUB_MOD_INIT): Likewise.
* font/font_cmd.c (GRUB_MOD_INIT): Likewise.
* kern/corecmd.c (GRUB_MOD_INIT): Likewise.
* mmap/mmap.c (GRUB_MOD_INIT): Likewise.
* normal/context.c (GRUB_MOD_INIT): Likewise.
* normal/main.c (GRUB_MOD_INIT): Likewise.
* term/gfxterm.c (GRUB_MOD_INIT): Likewise.
* term/serial.c (GRUB_MOD_INIT): Likewise.
* term/terminfo.c (GRUB_MOD_INIT): Likewise.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* kern/mm.c (grub_real_malloc): Satisfy alignment requirement when
extra == 0.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* commands/iorw.c: New file.
* conf/i386.rmk (pkglib_MODULES): Add iorw.mod.
(iorw_mod_SOURCES): New variable.
(iorw_mod_CFLAGS): Likewise.
(iorw_mod_LDFLAGS): Likewise.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
Hotkey support
* include/grub/menu.h (grub_menu_entry): New field 'hotkey'.
* normal/main.c (hotkey_aliases): New variable.
(grub_normal_add_menu_entry): Parse "--hotkey".
* normal/menu_text.c (run_menu): Handle hotkeys.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* kern/i386/coreboot/init.c (grub_machine_init): Call
grub_machine_mmap_init on qemu.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* boot/i386/qemu/boot.S: Add a missing .code16.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
Use LBIO on coreboot.
* conf/i386-coreboot.rmk (kernel_img_SOURCES): Change
kern/i386/multiboot_mmap.c to kern/i386/coreboot/mmap.c.
* include/grub/i386/coreboot/memory.h (GRUB_LINUXBIOS_MEMBER_LINK):
New declaration.
* kern/i386/coreboot/init.c (grub_machine_init): Don't call
grub_machine_mmap_init on coreboot.
* kern/i386/coreboot/mmap.c (grub_linuxbios_table_iterate): Handle
GRUB_LINUXBIOS_MEMBER_LINK.
(grub_machine_mmap_iterate): Fix declaration.
* kern/i386/coreboot/startup.S: Don't save mbi location on coreboot.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
Split coreboot and multiboot ports.
* conf/i386-multiboot.rmk: New file.
* configure.ac: Add multiboot port.
* include/grub/i386/multiboot/boot.h: New file.
* include/grub/i386/multiboot/console.h: Likewise.
* include/grub/i386/multiboot/init.h: Likewise.
* include/grub/i386/multiboot/kernel.h: Likewise.
* include/grub/i386/multiboot/loader.h: Likewise.
* include/grub/i386/multiboot/memory.h: Likewise.
* include/grub/i386/multiboot/serial.h: Likewise.
* include/grub/i386/multiboot/time.h: Likewise.
* include/grub/multiboot.h: Add GRUB_MACHINE_MULTIBOOT to ifdef.
* loader/multiboot.c: Likewise.
* loader/multiboot_mbi2.c: Likewise.
* util/grub-mkrescue.in: Generate multiboot rescue.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
* kern/parser.c (grub_parser_execute): Cope with read-only config.
2010-05-01 Vladimir Serbinenko <phcoder@gmail.com>
Merge handling of input and output terminals. Fix a hang.
* commands/terminal.c (abstract_terminal): New struct.
(handle_command): New function. Based on grub_cmd_terminal_input.
(grub_cmd_terminal_input): Use handle_command.
(grub_cmd_terminal_output): Use handle_command.
2010-05-01 BVK Chaitanya <bvk.groups@gmail.com>
Fix comment handling.
* tests/grub_script_comments.in: New testcase.
* conf/tests.rmk: Rules for new testcase.
* script/yylex.l: Updated flex rules.
2010-04-28 Samuel Thibault <samuel.thibault@ens-lyon.org>
* docs/grub.texi (play): Document that zero pitches produce rests.
* commands/i386/pc/play.c (grub_cmd_play): Call 'grub_file_open' only
if argc is 1.
2010-04-27 Vladimir Serbinenko <phcoder@gmail.com>
* conf/x86-efi.rmk (linux_mod_SOURCES): Write explicitly to avoid
autogen issues.
2010-04-26 Christian Franke <franke@computer.org>
* include/grub/util/getroot.h (grub_get_prefix): Remove prototype.
* util/getroot.c [__CYGWIN__] (get_win32_path): Remove function.
(grub_get_prefix): Remove function.
* util/grub-emu.c (main): Replace grub_get_prefix () call by
make_system_path_relative_to_its_root ().
* util/sparc64/ieee1275/grub-setup.c (main): Likewise.
2010-04-24 Christian Franke <franke@computer.org>
* Makefile.in (TARGET_LDFLAGS): Add -static-libgcc.
(kernel_img_LDFLAGS): Remove -static-libgcc.
2010-04-24 Christian Franke <franke@computer.org>
* configure.ac: Do not CHECK_BSS_START_SYMBOL
and CHECK_END_SYMBOL if grub-emu is built.
Unset TARGET_OBJ2ELF if grub-emu is built
without module support.
2010-04-24 Jiro SEKIBA <jir@unicus.jp>
Nilfs2 support.
* conf/common.rmk (grub_probe_SOURCES): Add fs/nilfs2.c.
(grub_fstest_SOURCES): Likewise.
(pkglib_MODULES): Add nilfs2.mod.
(nilfs2_mod_SOURCES): New variable.
(nilfs2_mod_CFLAGS): Likewise.
(nilfs2_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (grub_setup_SOURCES): Add fs/nilfs2.c.
* conf/sparc64-ieee1275.rmk (grub_setup_SOURCES): Add fs/nilfs2.c.
* fs/nilfs2.c: New file.
2010-04-21 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Refuse to compile for x86_64-efi is mcmodel=large
@ -69,7 +682,7 @@
* disk/lvm.c (grub_lvm_memberlist): Issue an error if pv->disk = 0.
2010-04-17 Christian Franke <franke@computer.org>
2010-04-17 Christian Franke <franke@computer.org>
* Makefile.in: Add missing localedir setting.

View file

@ -90,7 +90,7 @@ GNULIB_CFLAGS = $(GNULIB_UTIL_CFLAGS) $(POSIX_CFLAGS)
ASFLAGS = @ASFLAGS@
LDFLAGS = @LDFLAGS@ $(LIBS)
CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \
-DGRUB_LIBDIR=\"$(pkglibdir)\" -DLOCALEDIR=\"$(localedir)\"
-DGRUB_PKGLIBROOTDIR=\"$(libdir)/`echo @PACKAGE_TARNAME@ | sed '$(transform)'`\" -DLOCALEDIR=\"$(localedir)\"
TARGET_CC = @TARGET_CC@
TARGET_CFLAGS = -ffreestanding @TARGET_CFLAGS@
TARGET_ASFLAGS = -nostdinc -fno-builtin @TARGET_ASFLAGS@
@ -99,12 +99,12 @@ TARGET_APPLE_CC = @TARGET_APPLE_CC@
OBJCONV = @OBJCONV@
TARGET_CPPFLAGS = @TARGET_CPPFLAGS@ -I$(srcdir)/include -I$(builddir) -I$(builddir)/include \
-Wall -W
TARGET_LDFLAGS = -nostdlib @TARGET_LDFLAGS@
TARGET_LDFLAGS = -nostdlib -static-libgcc @TARGET_LDFLAGS@
TARGET_IMG_LDSCRIPT = @TARGET_IMG_LDSCRIPT@
TARGET_IMG_LDFLAGS = -nostdlib @TARGET_IMG_LDFLAGS@
TARGET_IMG_CFLAGS = @TARGET_IMG_CFLAGS@
TARGET_OBJ2ELF = @TARGET_OBJ2ELF@
kernel_img_LDFLAGS = -static-libgcc -lgcc
kernel_img_LDFLAGS = -lgcc
EXEEXT = @EXEEXT@
OBJCOPY = @OBJCOPY@
STRIP = @STRIP@

View file

@ -31,7 +31,7 @@ _start:
jmp 1f
. = _start + GRUB_BOOT_MACHINE_CORE_ENTRY_ADDR
. = _start + GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR
VARIABLE(grub_core_entry_addr)
.long 0
1:
@ -63,5 +63,8 @@ VARIABLE(grub_core_entry_addr)
*right here* and this is why we need this kludge. */
. = GRUB_BOOT_MACHINE_SIZE - 16
.code16
jmp _start
. = GRUB_BOOT_MACHINE_SIZE

View file

@ -19,6 +19,7 @@
#include <grub/boot.h>
#include <grub/machine/boot.h>
#include <grub/offsets.h>
.text
.align 4
@ -87,8 +88,8 @@ after_info_block:
call console_write
mov NOTIFICATION_STRING_LEN, %o3
GET_ABS(firstlist - GRUB_BOOT_MACHINE_LIST_SIZE, %l2)
set GRUB_BOOT_MACHINE_IMAGE_ADDRESS, %l3
GET_ABS(firstlist - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2)
set GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS, %l3
bootloop:
lduw [%l2 + 0x08], %o0
brz %o0, bootit
@ -115,7 +116,7 @@ bootloop:
mov NOTIFICATION_STEP_LEN, %o3
ba bootloop
sub %l2, GRUB_BOOT_MACHINE_LIST_SIZE, %l2
sub %l2, GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2
bootit:
GET_ABS(prom_close_name, %o0)
@ -127,8 +128,8 @@ bootit:
GET_ABS(notification_done, %o2)
call console_write
mov NOTIFICATION_DONE_LEN, %o3
sethi %hi(GRUB_BOOT_MACHINE_IMAGE_ADDRESS), %o2
jmpl %o2 + %lo(GRUB_BOOT_MACHINE_IMAGE_ADDRESS), %o7
sethi %hi(GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o2
jmpl %o2 + %lo(GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o7
mov CIF_REG, %o4
1: ba,a 1b
@ -136,7 +137,7 @@ lastlist:
.word 0
.word 0
. = _start + (0x200 - GRUB_BOOT_MACHINE_LIST_SIZE)
. = _start + (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE)
blocklist_default_start:
.word 0
.word 2

View file

@ -105,14 +105,14 @@ grub_usb_root_hub (grub_usb_controller_t controller __attribute__((unused)))
grub_usb_err_t
grub_usb_control_msg (grub_usb_device_t dev, grub_uint8_t reqtype,
grub_uint8_t request, grub_uint16_t value,
grub_uint16_t index, grub_size_t size, char *data)
grub_uint16_t idx, grub_size_t size, char *data)
{
usb_dev_handle *devh;
struct usb_device *d = dev->data;
devh = usb_open (d);
if (usb_control_msg (devh, reqtype, request,
value, index, data, size, 20) < 0)
value, idx, data, size, 20) < 0)
{
usb_close (devh);
return GRUB_USB_ERR_STALL;

View file

@ -24,13 +24,14 @@
#include <grub/misc.h>
#include <grub/crypto.h>
#include <grub/normal.h>
#include <grub/i18n.h>
static const struct grub_arg_option options[] = {
{"hash", 'h', 0, "Specify hash to use.", "HASH", ARG_TYPE_STRING},
{"check", 'c', 0, "Check hash list file.", "FILE", ARG_TYPE_STRING},
{"prefix", 'p', 0, "Base directory for hash list.", "DIRECTORY",
{"hash", 'h', 0, N_("Specify hash to use."), N_("HASH"), ARG_TYPE_STRING},
{"check", 'c', 0, N_("Check hash list file."), N_("FILE"), ARG_TYPE_STRING},
{"prefix", 'p', 0, N_("Base directory for hash list."), N_("DIRECTORY"),
ARG_TYPE_STRING},
{"keep-going", 'k', 0, "Don't stop after first error.", 0, 0},
{"keep-going", 'k', 0, N_("Don't stop after first error."), 0, 0},
{0, 0, 0, 0, 0, 0}
};
@ -249,21 +250,21 @@ GRUB_MOD_INIT(hashsum)
options);
cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum,
GRUB_COMMAND_FLAG_BOTH,
"md5sum [-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]",
"Compute or check hash checksum.",
N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"),
N_("Compute or check hash checksum."),
options);
cmd_sha256 = grub_register_extcmd ("sha256sum", grub_cmd_hashsum,
GRUB_COMMAND_FLAG_BOTH,
"sha256sum [-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]",
N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"),
"Compute or check hash checksum.",
options);
cmd_sha512 = grub_register_extcmd ("sha512sum", grub_cmd_hashsum,
GRUB_COMMAND_FLAG_BOTH,
"sha512sum [-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]",
"Compute or check hash checksum.",
N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"),
N_("Compute or check hash checksum."),
options);
}

View file

@ -100,7 +100,7 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD)
grub_arg_show_help ((grub_extcmd_t) cmd->data);
else
grub_printf ("%s %s %s\n%s\b", _("Usage:"), cmd->name, _(cmd->summary),
grub_printf ("%s %s %s\n%s\n", _("Usage:"), cmd->name, _(cmd->summary),
_(cmd->description));
}
}

View file

@ -402,11 +402,10 @@ GRUB_MOD_INIT (drivemap)
grub_get_root_biosnumber_saved = grub_get_root_biosnumber;
grub_get_root_biosnumber = grub_get_root_biosnumber_drivemap;
cmd = grub_register_extcmd ("drivemap", grub_cmd_drivemap,
GRUB_COMMAND_FLAG_BOTH,
"drivemap"
N_("-l | -r | [-s] grubdev osdisk."),
N_("Manage the BIOS drive mappings."),
options);
GRUB_COMMAND_FLAG_BOTH,
N_("-l | -r | [-s] grubdev osdisk."),
N_("Manage the BIOS drive mappings."),
options);
drivemap_hook =
grub_loader_register_preboot_hook (&install_int13_handler,
&uninstall_int13_handler,

View file

@ -177,16 +177,20 @@ static grub_err_t
grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
{
grub_file_t file;
if (argc < 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name or tempo and notes required");
file = grub_file_open (args[0]);
if (file)
if (argc == 1)
{
struct note buf;
grub_uint32_t tempo;
grub_file_t file;
file = grub_file_open (args[0]);
if (! file)
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo))
{

150
commands/iorw.c Normal file
View file

@ -0,0 +1,150 @@
/* memrw.c - command to read / write physical memory */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/extcmd.h>
#include <grub/env.h>
#include <grub/cpu/io.h>
#include <grub/i18n.h>
static grub_extcmd_t cmd_read_byte, cmd_read_word, cmd_read_dword;
static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword;
static const struct grub_arg_option options[] =
{
{0, 'v', 0, N_("Save read value into variable VARNAME."),
N_("VARNAME"), ARG_TYPE_STRING},
{0, 0, 0, 0, 0, 0}
};
static grub_err_t
grub_cmd_read (grub_extcmd_t cmd, int argc, char **argv)
{
grub_target_addr_t addr;
grub_uint32_t value = 0;
char buf[sizeof ("XXXXXXXX")];
if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
addr = grub_strtoul (argv[0], 0, 0);
switch (cmd->cmd->name[sizeof ("in") - 1])
{
case 'l':
value = grub_inl (addr);
break;
case 'w':
value = grub_inw (addr);
break;
case 'b':
value = grub_inb (addr);
break;
}
if (cmd->state[0].set)
{
grub_snprintf (buf, sizeof (buf), "%x", value);
grub_env_set (cmd->state[0].arg, buf);
}
else
grub_printf ("0x%x\n", value);
return 0;
}
static grub_err_t
grub_cmd_write (grub_command_t cmd, int argc, char **argv)
{
grub_target_addr_t addr;
grub_uint32_t value;
grub_uint32_t mask = 0xffffffff;
if (argc != 2 && argc != 3)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Invalid number of arguments");
addr = grub_strtoul (argv[0], 0, 0);
value = grub_strtoul (argv[1], 0, 0);
if (argc == 3)
mask = grub_strtoul (argv[2], 0, 0);
value &= mask;
switch (cmd->name[sizeof ("out") - 1])
{
case 'l':
if (mask != 0xffffffff)
grub_outl ((grub_inl (addr) & ~mask) | value, addr);
else
grub_outl (value, addr);
break;
case 'w':
if ((mask & 0xffff) != 0xffff)
grub_outw ((grub_inw (addr) & ~mask) | value, addr);
else
grub_outw (value, addr);
break;
case 'b':
if ((mask & 0xff) != 0xff)
grub_outb ((grub_inb (addr) & ~mask) | value, addr);
else
grub_outb (value, addr);
break;
}
return 0;
}
GRUB_MOD_INIT(memrw)
{
cmd_read_byte =
grub_register_extcmd ("inb", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
N_("PORT"), N_("Read byte from PORT."), options);
cmd_read_word =
grub_register_extcmd ("inw", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
N_("PORT"), N_("Read word from PORT."), options);
cmd_read_dword =
grub_register_extcmd ("inl", grub_cmd_read, GRUB_COMMAND_FLAG_BOTH,
N_("PORT"), N_("Read dword from PORT."), options);
cmd_write_byte =
grub_register_command ("outb", grub_cmd_write,
N_("PORT VALUE [MASK]"),
N_("Write byte VALUE to PORT."));
cmd_write_word =
grub_register_command ("outw", grub_cmd_write,
N_("PORT VALUE [MASK]"),
N_("Write word VALUE to PORT."));
cmd_write_dword =
grub_register_command ("outl", grub_cmd_write,
N_("ADDR VALUE [MASK]"),
N_("Write dword VALUE to PORT."));
}
GRUB_MOD_FINI(memrw)
{
grub_unregister_extcmd (cmd_read_byte);
grub_unregister_extcmd (cmd_read_word);
grub_unregister_extcmd (cmd_read_dword);
grub_unregister_command (cmd_write_byte);
grub_unregister_command (cmd_write_word);
grub_unregister_command (cmd_write_dword);
}

View file

@ -175,7 +175,7 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
}
/* Load modules. */
#if GRUB_NO_MODULES
#if !GRUB_NO_MODULES
{
const char *prefix;
prefix = grub_env_get ("prefix");

View file

@ -24,6 +24,7 @@
#include <grub/env.h>
#include <grub/normal.h>
#include <grub/dl.h>
#include <grub/i18n.h>
static grub_dl_t my_mod;
@ -186,8 +187,8 @@ GRUB_MOD_INIT(password_pbkdf2)
{
my_mod = mod;
cmd = grub_register_command ("password_pbkdf2", grub_cmd_password,
"password_pbkdf2 USER PBKDF2_PASSWORD",
"Set user password (PBKDF2). ");
N_("USER PBKDF2_PASSWORD"),
N_("Set user password (PBKDF2). "));
}
GRUB_MOD_FINI(password_pbkdf2)

View file

@ -21,6 +21,7 @@
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/command.h>
#include <grub/i18n.h>
#include <regex.h>
static grub_err_t
@ -69,8 +70,8 @@ static grub_command_t cmd;
GRUB_MOD_INIT(regexp)
{
cmd = grub_register_command ("regexp", grub_cmd_regexp,
"REGEXP STRING",
"Test if REGEXP matches STRING.");
N_("REGEXP STRING"),
N_("Test if REGEXP matches STRING."));
}
GRUB_MOD_FINI(regexp)

View file

@ -23,6 +23,7 @@
#include <grub/extcmd.h>
#include <grub/env.h>
#include <grub/mm.h>
#include <grub/i18n.h>
struct pci_register
{
@ -329,9 +330,9 @@ static grub_extcmd_t cmd;
GRUB_MOD_INIT(setpci)
{
cmd = grub_register_extcmd ("setpci", grub_cmd_setpci, GRUB_COMMAND_FLAG_BOTH,
"setpci [-s POSITION] [-d DEVICE] [-v VAR] "
"[REGISTER][=VALUE[:MASK]]",
"Manipulate PCI devices.", options);
N_("[-s POSITION] [-d DEVICE] [-v VAR] "
"[REGISTER][=VALUE[:MASK]]"),
N_("Manipulate PCI devices."), options);
}
GRUB_MOD_FINI(setpci)

View file

@ -26,37 +26,48 @@
struct grub_term_autoload *grub_term_input_autoload = NULL;
struct grub_term_autoload *grub_term_output_autoload = NULL;
struct abstract_terminal
{
struct abstract_terminal *next;
const char *name;
grub_err_t (*init) (void);
grub_err_t (*fini) (void);
};
static grub_err_t
grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
handle_command (int argc, char **args, struct abstract_terminal **enabled,
struct abstract_terminal **disabled,
struct grub_term_autoload *autoloads,
const char *active_str,
const char *available_str)
{
int i;
grub_term_input_t term;
struct abstract_terminal *term;
struct grub_term_autoload *aut;
if (argc == 0)
{
grub_puts_ (N_ ("Active input terminals:"));
FOR_ACTIVE_TERM_INPUTS(term)
grub_printf ("%s ", term->name);
grub_puts_ (active_str);
for (term = *enabled; term; term = term->next)
grub_printf ("%s ", term->name);
grub_printf ("\n");
grub_puts_ (N_ ("Available input terminals:"));
FOR_DISABLED_TERM_INPUTS(term)
grub_printf ("%s ", term->name);
grub_puts_ (available_str);
for (term = *disabled; term; term = term->next)
grub_printf ("%s ", term->name);
/* This is quadratic but we don't expect mode than 30 terminal
modules ever. */
for (aut = grub_term_input_autoload; aut; aut = aut->next)
{
FOR_DISABLED_TERM_INPUTS(term)
if (grub_strcmp (term->name, aut->name) == 0)
break;
if (!term)
FOR_ACTIVE_TERM_INPUTS(term)
if (grub_strcmp (term->name, aut->name) == 0)
break;
if (!term)
grub_printf ("%s ", aut->name);
}
modules ever. */
for (aut = autoloads; aut; aut = aut->next)
{
for (term = *disabled; term; term = term->next)
if (grub_strcmp (term->name, aut->name) == 0)
break;
if (!term)
for (term = *enabled; term; term = term->next)
if (grub_strcmp (term->name, aut->name) == 0)
break;
if (!term)
grub_printf ("%s ", aut->name);
}
grub_printf ("\n");
return GRUB_ERR_NONE;
}
@ -73,112 +84,108 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
{
int again = 0;
while (1)
{
FOR_DISABLED_TERM_INPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term == 0)
FOR_ACTIVE_TERM_INPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
break;
if (again)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
args[i]);
for (aut = grub_term_input_autoload; aut; aut = aut->next)
if (grub_strcmp (args[i], aut->name) == 0)
{
grub_dl_t mod;
mod = grub_dl_load (aut->modname);
if (mod)
grub_dl_ref (mod);
grub_errno = GRUB_ERR_NONE;
break;
}
if (!aut)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
args[i]);
again = 1;
}
{
for (term = *disabled; term; term = term->next)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term == 0)
for (term = *enabled; term; term = term->next)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
break;
if (again)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
args[i]);
for (aut = autoloads; aut; aut = aut->next)
if (grub_strcmp (args[i], aut->name) == 0)
{
grub_dl_t mod;
mod = grub_dl_load (aut->modname);
if (mod)
grub_dl_ref (mod);
grub_errno = GRUB_ERR_NONE;
break;
}
if (!aut)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
args[i]);
again = 1;
}
}
if (grub_strcmp (args[0], "--append") == 0)
{
for (i = 1; i < argc; i++)
{
FOR_DISABLED_TERM_INPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
{
for (term = *disabled; term; term = term->next)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
if (term->init && term->init () != GRUB_ERR_NONE)
return grub_errno;
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
GRUB_AS_LIST (term));
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
GRUB_AS_LIST (term));
}
}
grub_list_remove (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
grub_list_push (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
}
}
return GRUB_ERR_NONE;
}
if (grub_strcmp (args[0], "--remove") == 0)
{
for (i = 1; i < argc; i++)
{
FOR_ACTIVE_TERM_INPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
if (!term->next && term == grub_term_inputs)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"can't remove the last terminal");
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs)),
GRUB_AS_LIST (term));
if (term->fini)
term->fini ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
GRUB_AS_LIST (term));
}
}
{
for (term = *enabled; term; term = term->next)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
if (!term->next && term == *enabled)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"can't remove the last terminal");
grub_list_remove (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
if (term->fini)
term->fini ();
grub_list_push (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
}
}
return GRUB_ERR_NONE;
}
for (i = 0; i < argc; i++)
{
FOR_DISABLED_TERM_INPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
for (term = *disabled; term; term = term->next)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
if (term->init && term->init () != GRUB_ERR_NONE)
return grub_errno;
{
if (term->init && term->init () != GRUB_ERR_NONE)
return grub_errno;
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs_disabled)),
GRUB_AS_LIST (term));
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs),
GRUB_AS_LIST (term));
}
grub_list_remove (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
grub_list_push (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
}
}
FOR_ACTIVE_TERM_INPUTS(term)
{
for (i = 0; i < argc; i++)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (i == argc)
struct abstract_terminal *next;
for (term = *enabled; term; term = next)
{
if (!term->next && term == grub_term_inputs)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"can't remove the last terminal");
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_inputs)),
GRUB_AS_LIST (term));
if (term->fini)
term->fini ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
GRUB_AS_LIST (term));
next = term->next;
for (i = 0; i < argc; i++)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (i == argc)
{
if (!term->next && term == *enabled)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"can't remove the last terminal");
grub_list_remove (GRUB_AS_LIST_P (enabled), GRUB_AS_LIST (term));
if (term->fini)
term->fini ();
grub_list_push (GRUB_AS_LIST_P (disabled), GRUB_AS_LIST (term));
}
}
}
@ -186,163 +193,34 @@ grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
}
static grub_err_t
grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
grub_cmd_terminal_input (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
{
int i;
grub_term_output_t term;
struct grub_term_autoload *aut;
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, next);
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, name);
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, init);
(void) GRUB_FIELD_MATCH (grub_term_inputs, struct abstract_terminal *, fini);
return handle_command (argc, args,
(struct abstract_terminal **) &grub_term_inputs,
(struct abstract_terminal **) &grub_term_inputs_disabled,
grub_term_input_autoload,
N_ ("Active input terminals:"),
N_ ("Available input terminals:"));
}
if (argc == 0)
{
grub_puts_ (N_ ("Active output terminals:"));
FOR_ACTIVE_TERM_OUTPUTS(term)
grub_printf ("%s ", term->name);
grub_printf ("\n");
grub_puts_ (N_ ("Available output terminals:"));
FOR_DISABLED_TERM_OUTPUTS(term)
grub_printf ("%s ", term->name);
/* This is quadratic but we don't expect mode than 30 terminal
modules ever. */
for (aut = grub_term_output_autoload; aut; aut = aut->next)
{
FOR_DISABLED_TERM_OUTPUTS(term)
if (grub_strcmp (term->name, aut->name) == 0)
break;
if (!term)
FOR_ACTIVE_TERM_OUTPUTS(term)
if (grub_strcmp (term->name, aut->name) == 0)
break;
if (!term)
grub_printf ("%s ", aut->name);
}
grub_printf ("\n");
return GRUB_ERR_NONE;
}
i = 0;
if (grub_strcmp (args[0], "--append") == 0
|| grub_strcmp (args[0], "--remove") == 0)
i++;
if (i == argc)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_ ("no terminal specified"));
for (; i < argc; i++)
{
int again = 0;
while (1)
{
FOR_DISABLED_TERM_OUTPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term == 0)
FOR_ACTIVE_TERM_OUTPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
break;
if (again)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
args[i]);
for (aut = grub_term_output_autoload; aut; aut = aut->next)
if (grub_strcmp (args[i], aut->name) == 0)
{
grub_dl_t mod;
mod = grub_dl_load (aut->modname);
if (mod)
grub_dl_ref (mod);
grub_errno = GRUB_ERR_NONE;
break;
}
if (!aut)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown terminal '%s'\n",
args[i]);
again = 1;
}
}
if (grub_strcmp (args[0], "--append") == 0)
{
for (i = 1; i < argc; i++)
{
FOR_DISABLED_TERM_OUTPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
if (term->init && term->init () != GRUB_ERR_NONE)
return grub_errno;
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
GRUB_AS_LIST (term));
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
GRUB_AS_LIST (term));
}
}
return GRUB_ERR_NONE;
}
if (grub_strcmp (args[0], "--remove") == 0)
{
for (i = 1; i < argc; i++)
{
FOR_ACTIVE_TERM_OUTPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
if (!term->next && term == grub_term_outputs)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"can't remove the last terminal");
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs)),
GRUB_AS_LIST (term));
if (term->fini)
term->fini ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
GRUB_AS_LIST (term));
}
}
return GRUB_ERR_NONE;
}
for (i = 0; i < argc; i++)
{
FOR_DISABLED_TERM_OUTPUTS(term)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (term)
{
if (term->init && term->init () != GRUB_ERR_NONE)
return grub_errno;
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs_disabled)),
GRUB_AS_LIST (term));
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
GRUB_AS_LIST (term));
}
}
FOR_ACTIVE_TERM_OUTPUTS(term)
{
for (i = 0; i < argc; i++)
if (grub_strcmp (args[i], term->name) == 0)
break;
if (i == argc)
{
if (!term->next && term == grub_term_outputs)
return grub_error (GRUB_ERR_BAD_ARGUMENT,
"can't remove the last terminal");
grub_list_remove (GRUB_AS_LIST_P (&(grub_term_outputs)),
GRUB_AS_LIST (term));
if (term->fini)
term->fini ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
GRUB_AS_LIST (term));
}
}
return GRUB_ERR_NONE;
static grub_err_t
grub_cmd_terminal_output (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
{
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, next);
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, name);
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, init);
(void) GRUB_FIELD_MATCH (grub_term_outputs, struct abstract_terminal *, fini);
return handle_command (argc, args, (struct abstract_terminal **) &grub_term_outputs,
(struct abstract_terminal **) &grub_term_outputs_disabled,
grub_term_output_autoload,
N_ ("Active output terminals:"),
N_ ("Available output terminals:"));
}
static grub_command_t cmd_terminal_input, cmd_terminal_output;
@ -351,14 +229,14 @@ GRUB_MOD_INIT(terminal)
{
cmd_terminal_input =
grub_register_command ("terminal_input", grub_cmd_terminal_input,
"[--append|--remove] "
"[TERMINAL1] [TERMINAL2] ...",
"List or select an input terminal.");
N_("[--append|--remove] "
"[TERMINAL1] [TERMINAL2] ..."),
N_("List or select an input terminal."));
cmd_terminal_output =
grub_register_command ("terminal_output", grub_cmd_terminal_output,
"[--append|--remove] "
"[TERMINAL1] [TERMINAL2] ...",
"List or select an output terminal.");
N_("[--append|--remove] "
"[TERMINAL1] [TERMINAL2] ..."),
N_("List or select an output terminal."));
}
GRUB_MOD_FINI(terminal)

View file

@ -9,13 +9,14 @@ kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
kern/corecmd.c kern/file.c kern/fs.c kern/main.c kern/misc.c \
kern/parser.c kern/partition.c kern/term.c \
kern/rescue_reader.c kern/rescue_parser.c \
\
util/console.c util/grub-emu.c util/misc.c \
util/hostdisk.c util/getroot.c util/mm.c util/time.c \
\
gnulib/progname.c util/hostfs.c disk/host.c
kernel_img_HEADERS += datetime.h util/misc.h
kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-undef -I$(srcdir)/gnulib
\
kern/emu/main.c kern/emu/mm.c kern/emu/misc.c \
kern/emu/getroot.c kern/emu/time.c kern/emu/hostdisk.c \
kern/emu/hostfs.c kern/emu/console.c \
\
gnulib/progname.c disk/host.c
kernel_img_HEADERS += datetime.h emu/misc.h
kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-char-subscripts -Wno-unused -Wno-deprecated-declarations -Wno-undef -I$(srcdir)/gnulib
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
TARGET_NO_STRIP = yes
@ -49,7 +50,7 @@ ifeq ($(enable_grub_emu_usb), yes)
kernel_img_HEADERS += libusb.h
pkglib_MODULES += libusb.mod
libusb_mod_SOURCES = util/usb.c
libusb_mod_SOURCES = bus/usb/emu/usb.c
libusb_mod_CFLAGS =
libusb_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -76,7 +77,7 @@ endif
ifeq ($(enable_grub_emu_sdl), yes)
pkglib_MODULES += sdl.mod
sdl_mod_SOURCES = util/sdl.c
sdl_mod_SOURCES = video/emu/sdl.c
sdl_mod_CFLAGS =
sdl_mod_LDFLAGS = $(COMMON_LDFLAGS)
grub_emu_LDFLAGS += $(LIBSDL)
@ -85,7 +86,7 @@ endif
ifeq ($(enable_grub_emu_pci), yes)
pkglib_MODULES += pci.mod
pci_mod_SOURCES = util/pci.c commands/lspci.c
pci_mod_SOURCES = bus/emu/pci.c commands/lspci.c
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
grub_emu_LDFLAGS += $(LIBPCIACCESS)
kernel_img_HEADERS += libpciaccess.h
@ -104,10 +105,10 @@ DISTCLEANFILES += grub_emu_init.c
CLEANFILES += grub-emu
ifneq ($(TARGET_NO_MODULES), yes)
grub-emu: $(pkglib_PROGRAMS)
$(CC) -o $@ $(pkglib_PROGRAMS) $(grub_emu_LDFLAGS) $(LDFLAGS)
$(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS)
else
grub-emu: $(pkglib_MODULES) $(pkglib_PROGRAMS)
$(CC) -o $@ $(pkglib_MODULES) $(pkglib_PROGRAMS) $(grub_emu_LDFLAGS) $(LDFLAGS)
$(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS)
endif
GRUB_EMU=grub-emu

View file

@ -6,7 +6,8 @@ script/lexer.c_DEPENDENCIES = grub_script.tab.h
sbin_UTILITIES += grub-mkdevicemap
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
util/deviceiter.c \
util/misc.c
util/misc.c kern/emu/misc.c \
kern/env.c kern/err.c kern/list.c kern/misc.c kern/emu/mm.c
ifeq ($(target_cpu)-$(platform), sparc64-ieee1275)
grub_mkdevicemap_SOURCES += util/ieee1275/ofpath.c util/ieee1275/devicemap.c
@ -14,26 +15,25 @@ else
grub_mkdevicemap_SOURCES += util/devicemap.c
endif
# For grub-mkelfimage.
bin_UTILITIES += grub-mkelfimage
grub_mkelfimage_SOURCES = gnulib/progname.c \
util/elf/grub-mkimage.c util/misc.c \
util/resolve.c
util/elf/grub-mkimage.c_DEPENDENCIES = Makefile
# For grub-mkimage.
bin_UTILITIES += grub-mkimage
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkimage.c util/misc.c \
util/resolve.c kern/emu/misc.c lib/LzmaEnc.c lib/LzFind.c
util/grub-mkimage.c_DEPENDENCIES = Makefile
# For grub-probe.
sbin_UTILITIES += grub-probe
util/grub-probe.c_DEPENDENCIES = grub_probe_init.h
grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
util/hostdisk.c util/misc.c util/getroot.c util/mm.c \
kern/emu/hostdisk.c util/misc.c kern/emu/misc.c kern/emu/getroot.c kern/emu/mm.c \
kern/device.c kern/disk.c kern/err.c kern/misc.c \
kern/parser.c kern/partition.c kern/file.c kern/list.c \
\
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
fs/befs.c fs/befs_be.c fs/tar.c \
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \
fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \
\
partmap/msdos.c partmap/bsdlabel.c partmap/apple.c \
partmap/sun.c partmap/sunpc.c partmap/gpt.c \
@ -44,24 +44,10 @@ ifeq ($(enable_grub_fstest), yes)
bin_UTILITIES += grub-fstest
endif
bin_UTILITIES += grub-mkisofs
grub_mkisofs_SOURCES = util/mkisofs/eltorito.c \
util/mkisofs/hash.c util/mkisofs/joliet.c \
util/mkisofs/match.c util/mkisofs/mkisofs.c \
util/mkisofs/multi.c util/mkisofs/name.c \
util/mkisofs/rock.c util/mkisofs/tree.c \
util/mkisofs/write.c \
\
gnulib/fnmatch.c gnulib/getopt1.c gnulib/getopt.c \
gnulib/error.c gnulib/progname.c
grub_mkisofs_CFLAGS = -D_FILE_OFFSET_BITS=64 \
-I$(srcdir)/util/mkisofs/include \
-Wno-all -Werror $(GNULIB_UTIL_CFLAGS)
# For grub-fstest.
util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h
grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.c \
util/misc.c util/mm.c \
grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c kern/emu/hostfs.c \
util/misc.c kern/emu/misc.c kern/emu/mm.c \
kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c \
disk/host.c disk/loopback.c kern/list.c kern/command.c \
lib/arg.c commands/extcmd.c normal/datetime.c normal/misc.c \
@ -69,7 +55,7 @@ grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.c \
\
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c fs/befs.c \
fs/befs_be.c fs/tar.c \
\
@ -83,14 +69,14 @@ grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.c \
# For grub-mkfont.
ifeq ($(enable_grub_mkfont), yes)
bin_UTILITIES += grub-mkfont
grub_mkfont_SOURCES = gnulib/progname.c util/grub-mkfont.c util/misc.c
grub_mkfont_SOURCES = gnulib/progname.c util/grub-mkfont.c util/misc.c kern/emu/misc.c
grub_mkfont_CFLAGS = $(freetype_cflags)
grub_mkfont_LDFLAGS = $(freetype_libs)
endif
# For grub-mkrelpath.
bin_UTILITIES += grub-mkrelpath
grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c
grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c kern/emu/misc.c
bin_UTILITIES += grub-bin2h
grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.c
@ -104,7 +90,7 @@ DISTCLEANFILES += grub_script.yy.c grub_script.yy.h
bin_UTILITIES += grub-script-check
util/grub-script-check.c_DEPENDENCIES = grub_script_check_init.h
grub_script_check_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c \
util/grub-script-check.c util/misc.c util/mm.c \
util/grub-script-check.c util/misc.c kern/emu/misc.c kern/emu/mm.c \
script/main.c script/script.c script/function.c script/lexer.c \
kern/handler.c kern/err.c kern/parser.c kern/list.c \
kern/misc.c kern/env.c grub_script_check_init.c grub_script.tab.c \
@ -119,7 +105,7 @@ kernel_img_HEADERS += boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
list.h handler.h command.h i18n.h env_private.h libgcc.h
ifneq ($(platform), emu)
kernel_img_HEADERS += machine/memory.h machine/loader.h machine/kernel.h
kernel_img_HEADERS += machine/memory.h machine/loader.h
endif
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
@ -187,7 +173,7 @@ DISTCLEANFILES += grub_fstest_init.c
# for grub-editenv
bin_UTILITIES += grub-editenv
grub_editenv_SOURCES = gnulib/progname.c util/grub-editenv.c lib/envblk.c util/misc.c util/mm.c kern/misc.c kern/err.c
grub_editenv_SOURCES = gnulib/progname.c util/grub-editenv.c lib/envblk.c util/misc.c kern/emu/misc.c kern/emu/mm.c kern/misc.c kern/err.c
CLEANFILES += grub-editenv
# Needed for genmk.rb to work
@ -195,7 +181,7 @@ ifeq (0,1)
bin_UTILITIES += grub-macho2img grub-pe2elf
endif
grub_pe2elf_SOURCES = gnulib/progname.c util/grub-pe2elf.c util/misc.c
grub_pe2elf_SOURCES = gnulib/progname.c util/grub-pe2elf.c util/misc.c kern/emu/misc.c
CLEANFILES += grub-pe2elf
grub_macho2img_SOURCES = util/grub-macho2img.c
@ -298,6 +284,12 @@ minix_mod_SOURCES = fs/minix.c
minix_mod_CFLAGS = $(COMMON_CFLAGS)
minix_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For nilfs2.mod.
pkglib_MODULES += nilfs2.mod
nilfs2_mod_SOURCES = fs/nilfs2.c
nilfs2_mod_CFLAGS = $(COMMON_CFLAGS)
nilfs2_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For hfs.mod.
hfs_mod_SOURCES = fs/hfs.c
hfs_mod_CFLAGS = $(COMMON_CFLAGS)
@ -654,7 +646,7 @@ normal_mod_CFLAGS = $(COMMON_CFLAGS)
normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For sh.mod.
sh_mod_SOURCES = script/main.c script/script.c script/execute.c \
sh_mod_SOURCES = script/main.c script/script.c script/argv.c script/execute.c \
script/function.c script/lexer.c grub_script.tab.c grub_script.yy.c
sh_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS) -Wno-error
sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -855,7 +847,7 @@ boot_mod_CFLAGS = $(COMMON_CFLAGS)
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
bin_UTILITIES += grub-mkpasswd-pbkdf2
grub_mkpasswd_pbkdf2_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c util/grub-mkpasswd-pbkdf2.c lib/crypto.c lib/libgcrypt-grub/cipher/sha512.c lib/pbkdf2.c util/misc.c util/mm.c kern/err.c
grub_mkpasswd_pbkdf2_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c util/grub-mkpasswd-pbkdf2.c lib/crypto.c lib/libgcrypt-grub/cipher/sha512.c lib/pbkdf2.c util/misc.c kern/emu/misc.c kern/emu/mm.c kern/err.c
grub_mkpasswd_pbkdf2_CFLAGS += -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap -DGRUB_MKPASSWD=1
include $(srcdir)/conf/gcry.mk

View file

@ -4,13 +4,11 @@ COMMON_CFLAGS = -mrtd -mregparm=3
# Images.
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
pkglib_PROGRAMS += kernel.img
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
kern/i386/misc.S \
kern/i386/coreboot/init.c \
kern/i386/multiboot_mmap.c \
kern/i386/coreboot/mmap.c \
kern/i386/halt.c \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
@ -26,7 +24,7 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \
symlist.c
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x8200,-Bstatic
sbin_SCRIPTS += grub-install
grub_install_SOURCES = util/grub-install.in

74
conf/i386-multiboot.rmk Normal file
View file

@ -0,0 +1,74 @@
# -*- makefile -*-
COMMON_CFLAGS = -mrtd -mregparm=3
# Images.
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
pkglib_PROGRAMS += kernel.img
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
kern/i386/misc.S \
kern/i386/coreboot/init.c \
kern/i386/multiboot_mmap.c \
kern/i386/halt.c \
kern/main.c kern/device.c \
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
kern/misc.c kern/mm.c kern/term.c \
kern/rescue_parser.c kern/rescue_reader.c \
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
kern/i386/tsc.c kern/i386/pit.c \
kern/generic/rtc_get_time_ms.c \
kern/generic/millisleep.c \
kern/env.c \
term/i386/pc/vga_text.c term/i386/vga_common.c \
symlist.c
kernel_img_CFLAGS = $(COMMON_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
sbin_SCRIPTS += grub-install
grub_install_SOURCES = util/grub-install.in
bin_SCRIPTS += grub-mkrescue
grub_mkrescue_SOURCES = util/grub-mkrescue.in
# Modules.
pkglib_MODULES = linux.mod aout.mod halt.mod datetime.mod mmap.mod
# For mmap.mod.
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For linux.mod.
linux_mod_SOURCES = loader/i386/linux.c
linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For halt.mod.
halt_mod_SOURCES = commands/halt.c
halt_mod_CFLAGS = $(COMMON_CFLAGS)
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For aout.mod.
aout_mod_SOURCES = loader/aout.c
aout_mod_CFLAGS = $(COMMON_CFLAGS)
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For bsd.mod
pkglib_MODULES += bsd.mod
bsd_mod_SOURCES = loader/i386/bsd.c loader/i386/bsd32.c loader/i386/bsd64.c loader/i386/bsd_helper.S loader/i386/bsd_trampoline.S
bsd_mod_CFLAGS = $(COMMON_CFLAGS)
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
bsd_mod_ASFLAGS = $(COMMON_ASFLAGS)
# For datetime.mod
datetime_mod_SOURCES = lib/cmos_datetime.c
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
include $(srcdir)/conf/i386.mk
include $(srcdir)/conf/common.mk

View file

@ -1,12 +1,9 @@
# -*- makefile -*-
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
COMMON_CFLAGS = -mrtd -mregparm=3
# Images.
pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \
pxeboot.img
pkglib_IMAGES = boot.img cdboot.img diskboot.img lnxboot.img pxeboot.img
# For boot.img.
boot_img_SOURCES = boot/i386/pc/boot.S
@ -39,6 +36,7 @@ cdboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x7C00
cdboot_img_FORMAT = binary
# For kernel.img.
pkglib_PROGRAMS = kernel.img
kernel_img_SOURCES = kern/i386/pc/startup.S \
kern/i386/misc.S \
kern/main.c kern/device.c \
@ -55,42 +53,33 @@ kernel_img_SOURCES = kern/i386/pc/startup.S \
term/i386/pc/console.c term/i386/vga_common.c \
symlist.c
kernel_img_HEADERS += machine/biosdisk.h machine/vga.h machine/vbe.h \
machine/pxe.h i386/pit.h
machine/pxe.h i386/pit.h machine/kernel.h
kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
kernel_img_FORMAT = binary
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x8200 $(COMMON_CFLAGS)
# Utilities.
bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-setup
# For grub-mkimage.
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkrawimage.c util/misc.c \
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
# For grub-setup.
util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
grub_setup_SOURCES = gnulib/progname.c \
util/i386/pc/grub-setup.c util/hostdisk.c \
util/misc.c util/getroot.c kern/device.c kern/disk.c \
kern/err.c kern/misc.c kern/parser.c kern/partition.c \
kern/file.c kern/fs.c kern/env.c kern/list.c \
fs/fshelp.c \
\
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
fs/befs.c fs/befs_be.c fs/tar.c \
\
partmap/msdos.c partmap/bsdlabel.c partmap/sunpc.c \
partmap/gpt.c \
\
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
util/raid.c util/lvm.c util/mm.c \
grub_setup_SOURCES = gnulib/progname.c util/i386/pc/grub-setup.c \
util/misc.c kern/emu/misc.c kern/emu/getroot.c \
kern/emu/hostdisk.c kern/device.c kern/disk.c kern/err.c \
kern/misc.c kern/parser.c kern/partition.c kern/file.c \
kern/emu/mm.c kern/fs.c kern/env.c kern/list.c fs/fshelp.c \
\
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \
fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \
\
partmap/msdos.c partmap/bsdlabel.c partmap/sunpc.c \
partmap/gpt.c \
\
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
util/raid.c util/lvm.c \
grub_setup_init.c
sbin_SCRIPTS += grub-install
@ -185,7 +174,7 @@ vbetest_mod_CFLAGS = $(COMMON_CFLAGS)
vbetest_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For vga.mod.
vga_mod_SOURCES = term/i386/pc/vga.c
vga_mod_SOURCES = video/i386/pc/vga.c
vga_mod_CFLAGS = $(COMMON_CFLAGS)
vga_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -13,13 +13,7 @@ boot_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_M
boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_BOOT_MACHINE_LINK_ADDR)
boot_img_FORMAT = binary
bin_UTILITIES += grub-mkimage
grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
util/resolve.c gnulib/progname.c
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
pkglib_IMAGES += kernel.img
pkglib_PROGRAMS += kernel.img
kernel_img_SOURCES = kern/i386/qemu/startup.S \
kern/i386/misc.S \
kern/i386/coreboot/init.c \

View file

@ -68,3 +68,8 @@ play_mod_SOURCES = commands/i386/pc/play.c
play_mod_CFLAGS = $(COMMON_CFLAGS)
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For iorw.mod.
pkglib_MODULES += iorw.mod
iorw_mod_SOURCES = commands/iorw.c
iorw_mod_CFLAGS = $(COMMON_CFLAGS)
iorw_mod_LDFLAGS = $(COMMON_LDFLAGS)

View file

@ -5,7 +5,7 @@ COMMON_CFLAGS += -march=mips3
COMMON_ASFLAGS += -march=mips3
include $(srcdir)/conf/mips.mk
pkglib_IMAGES = kernel.img
pkglib_PROGRAMS = kernel.img
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
kern/$(target_cpu)/$(target_machine)/init.c \

View file

@ -8,7 +8,7 @@ kernel_img_HEADERS += pci.h bitmap.h video.h gfxterm.h font.h bitmap_scale.h buf
include $(srcdir)/conf/mips.mk
pkglib_IMAGES = kernel.img
pkglib_PROGRAMS = kernel.img
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
kern/$(target_cpu)/$(target_machine)/init.c \

View file

@ -10,13 +10,6 @@ kernel_img_HEADERS += cpu/cache.h
sbin_SCRIPTS =
bin_SCRIPTS =
# For grub-mkimage.
bin_UTILITIES += grub-mkimage
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkrawimage.c util/misc.c \
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(LINK_BASE)
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
# For serial.mod.
pkglib_MODULES += serial.mod
serial_mod_SOURCES = term/serial.c

View file

@ -5,7 +5,8 @@ COMMON_CFLAGS = -mno-app-regs
COMMON_LDFLAGS = -melf64_sparc -mno-relax
# Images.
pkglib_IMAGES = boot.img diskboot.img kernel.img
pkglib_IMAGES = boot.img diskboot.img
pkglib_PROGRAMS = kernel.img
# For boot.img.
boot_img_SOURCES = boot/sparc64/ieee1275/boot.S
@ -40,38 +41,33 @@ kernel_img_LDFLAGS += -nostdlib -Wl,-N,-Ttext,0x4400,-Bstatic,-melf64_sparc
kernel_img_FORMAT = binary
# Utilities.
bin_UTILITIES = grub-mkimage
sbin_UTILITIES = grub-setup grub-ofpathname
# For grub-mkimage.
grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
util/resolve.c gnulib/progname.c
# For grub-setup.
util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
util/ieee1275/ofpath.c \
util/misc.c util/getroot.c kern/device.c kern/disk.c \
kern/err.c kern/misc.c kern/parser.c kern/partition.c \
kern/file.c kern/fs.c kern/env.c kern/list.c \
fs/fshelp.c \
\
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c fs/afs_be.c \
fs/befs.c fs/befs_be.c fs/tar.c \
\
partmap/amiga.c partmap/apple.c partmap/msdos.c \
partmap/bsdlabel.c partmap/sun.c partmap/acorn.c \
\
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
util/raid.c util/lvm.c util/mm.c gnulib/progname.c \
grub_setup_init.c
grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c \
util/ieee1275/ofpath.c util/misc.c kern/emu/hostdisk.c \
kern/emu/misc.c kern/emu/getroot.c kern/emu/mm.c kern/device.c \
kern/disk.c kern/err.c kern/misc.c kern/parser.c \
kern/partition.c kern/file.c kern/fs.c kern/env.c kern/list.c \
fs/fshelp.c \
\
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \
fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \
\
partmap/amiga.c partmap/apple.c partmap/msdos.c \
partmap/bsdlabel.c partmap/sun.c partmap/acorn.c \
\
disk/raid.c disk/mdraid_linux.c disk/lvm.c util/raid.c \
util/lvm.c gnulib/progname.c grub_setup_init.c
# For grub-ofpathname.
grub_ofpathname_SOURCES = util/ieee1275/grub-ofpathname.c \
util/ieee1275/ofpath.c util/misc.c gnulib/progname.c
grub_ofpathname_SOURCES = util/ieee1275/grub-ofpathname.c \
util/ieee1275/ofpath.c util/misc.c kern/emu/misc.c \
gnulib/progname.c
# Scripts.
sbin_SCRIPTS = grub-install

View file

@ -68,6 +68,12 @@ grub_script_final_semicolon_SOURCES = tests/grub_script_final_semicolon.in
check_SCRIPTS += grub_script_dollar
grub_script_dollar_SOURCES = tests/grub_script_dollar.in
check_SCRIPTS += grub_script_comments
grub_script_comments_SOURCES = tests/grub_script_comments.in
check_SCRIPTS += grub_script_functions
grub_script_functions_SOURCES = tests/grub_script_functions.in
# List of tests to execute on "make check"
# SCRIPTED_TESTS = example_scripted_test
# SCRIPTED_TESTS += example_grub_script_test
@ -83,6 +89,8 @@ SCRIPTED_TESTS += grub_script_if
SCRIPTED_TESTS += grub_script_blanklines
SCRIPTED_TESTS += grub_script_final_semicolon
SCRIPTED_TESTS += grub_script_dollar
SCRIPTED_TESTS += grub_script_comments
SCRIPTED_TESTS += grub_script_functions
# dependencies between tests and testing-tools
$(SCRIPTED_TESTS): grub-shell grub-shell-tester

View file

@ -1,19 +1,14 @@
# -*- makefile -*-
# Utilities.
bin_UTILITIES = grub-mkimage
# For grub-mkimage.
grub_mkimage_SOURCES = gnulib/progname.c util/i386/efi/grub-mkimage.c \
util/misc.c util/resolve.c
util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile
# Scripts.
sbin_SCRIPTS = grub-install
# For grub-install.
grub_install_SOURCES = util/i386/efi/grub-install.in
bin_SCRIPTS += grub-mkrescue
grub_mkrescue_SOURCES = util/grub-mkrescue.in
# Modules.
pkglib_PROGRAMS = kernel.img
pkglib_MODULES = chain.mod appleldr.mod \
@ -64,13 +59,17 @@ appleldr_mod_CFLAGS = $(COMMON_CFLAGS)
appleldr_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For linux.mod.
linux_mod_SOURCES = loader/i386/efi/linux.c
ifeq ($(target_cpu), x86_64)
linux_mod_SOURCES += loader/i386/linux_trampoline.S
endif
linux_mod_SOURCES = loader/i386/efi/linux.c loader/i386/linux_trampoline.S
linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
else
linux_mod_SOURCES = loader/i386/efi/linux.c
linux_mod_CFLAGS = $(COMMON_CFLAGS)
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
endif
# For halt.mod.
halt_mod_SOURCES = commands/halt.c

View file

@ -102,6 +102,7 @@ case "$target_cpu"-"$platform" in
i386-efi) ;;
x86_64-efi) ;;
i386-pc) ;;
i386-multiboot) ;;
i386-coreboot) ;;
i386-linuxbios) platform=coreboot ;;
i386-ieee1275) ;;
@ -136,6 +137,7 @@ esac
case "$platform" in
coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;;
efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
@ -148,6 +150,7 @@ case "$target_cpu" in
mips) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_MIPS=1" ;;
sparc64) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
esac
machine_CFLAGS="$machine_CFLAGS -DMACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
CFLAGS="$CFLAGS $machine_CFLAGS"
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
@ -511,11 +514,11 @@ grub_PROG_OBJCOPY_ABSOLUTE
fi
grub_PROG_LD_BUILD_ID_NONE
if test "x$target_cpu" = xi386; then
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
# Check symbols provided by linker script.
CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC}8000,--defsym,___main=0x8100"
fi
if test "x$TARGET_APPLE_CC" != x1 ; then
if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
# Check symbols provided by linker script.
CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC}8000 -Wl,--defsym,___main=0x8100"
fi
grub_CHECK_BSS_START_SYMBOL
grub_CHECK_END_SYMBOL
fi
@ -635,6 +638,12 @@ else
fi
AC_SUBST(TARGET_NO_MODULES)
if test "$TARGET_NO_MODULES" = yes ; then
# Do not convert modules, otherwise linkage may fail (Cygwin only).
# FIXME: Should be checked above before TARGET_OBJ2ELF is set first.
TARGET_OBJ2ELF=
fi
if test x"$enable_grub_emu_usb" = xno ; then
grub_emu_usb_excuse="explicitly disabled"
fi
@ -771,6 +780,22 @@ AC_SUBST([enable_grub_mkfont])
AC_SUBST([freetype_cflags])
AC_SUBST([freetype_libs])
AC_ARG_ENABLE([device-mapper],
[AS_HELP_STRING([--enable-device-mapper],
[enable Linux device-mapper support (default=guessed)])])
if test x"$enable_device_mapper" = xno ; then
device_mapper_excuse="explicitly disabled"
fi
if test x"$device_mapper_excuse" = x ; then
# Check for device-mapper library.
AC_CHECK_LIB([devmapper], [dm_task_create],
[LDFLAGS="$LDFLAGS -ldevmapper"
AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
[Define to 1 if you have the devmapper library.])],
[device_mapper_excuse="need devmapper library"])
fi
AC_SUBST(ASFLAGS)
# Output files.

View file

@ -25,7 +25,7 @@
#include <grub/lvm.h>
#ifdef GRUB_UTIL
#include <grub/util/misc.h>
#include <grub/emu/misc.h>
#endif
static struct grub_lvm_vg *vg_list;

View file

@ -1379,7 +1379,8 @@ pitch and duration pairs.
If the arguments are a series of numbers, play the inline tune.
The tempo is the base for all note durations. 60 gives a 1-second base, 120
gives a half-second base, etc. Pitches are Hz.
gives a half-second base, etc. Pitches are Hz. Set pitch to 0 to produce
a rest.
@end deffn

View file

@ -31,6 +31,7 @@
#include <grub/efiemu/efiemu.h>
#include <grub/machine/efiemu.h>
#include <grub/command.h>
#include <grub/i18n.h>
/* System table. Two version depending on mode */
grub_efi_system_table32_t *grub_efiemu_system_table32 = 0;
@ -327,15 +328,15 @@ GRUB_MOD_INIT(efiemu)
{
cmd_loadcore = grub_register_command ("efiemu_loadcore",
grub_cmd_efiemu_load,
"FILE",
"Load and initialize EFI emulator.");
N_("FILE"),
N_("Load and initialize EFI emulator."));
cmd_prepare = grub_register_command ("efiemu_prepare",
grub_cmd_efiemu_prepare,
0,
"Finalize loading of EFI emulator.");
N_("Finalize loading of EFI emulator."));
cmd_unload = grub_register_command ("efiemu_unload", grub_cmd_efiemu_unload,
0,
"Unload EFI emulator.");
N_("Unload EFI emulator."));
}
GRUB_MOD_FINI(efiemu)

View file

@ -21,6 +21,7 @@
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/command.h>
#include <grub/i18n.h>
static grub_err_t
loadfont_command (grub_command_t cmd __attribute__ ((unused)),
@ -62,11 +63,11 @@ GRUB_MOD_INIT(font)
cmd_loadfont =
grub_register_command ("loadfont", loadfont_command,
"FILE...",
"Specify one or more font files to load.");
N_("FILE..."),
N_("Specify one or more font files to load."));
cmd_lsfonts =
grub_register_command ("lsfonts", lsfonts_command,
0, "List the loaded fonts.");
0, N_("List the loaded fonts."));
}
GRUB_MOD_FINI(font)

1133
fs/nilfs2.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -54,6 +54,7 @@ static void
circprog_destroy (void *vself)
{
circular_progress_t self = vself;
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
grub_free (self);
}
@ -211,6 +212,17 @@ circprog_get_bounds (void *vself, grub_video_rect_t *bounds)
*bounds = self->bounds;
}
static void
circprog_set_state (void *vself, int visible, int start,
int current, int end)
{
circular_progress_t self = vself;
self->visible = visible;
self->start = start;
self->value = current;
self->end = end;
}
static grub_err_t
circprog_set_property (void *vself, const char *name, const char *value)
{
@ -247,26 +259,20 @@ circprog_set_property (void *vself, const char *name, const char *value)
}
else if (grub_strcmp (name, "id") == 0)
{
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
grub_free (self->id);
if (value)
self->id = grub_strdup (value);
else
self->id = 0;
if (self->id && grub_strcmp (self->id, GRUB_GFXMENU_TIMEOUT_COMPONENT_ID)
== 0)
grub_gfxmenu_timeout_register ((grub_gui_component_t) self,
circprog_set_state);
}
return grub_errno;
}
static void
circprog_set_state (void *vself, int visible, int start,
int current, int end)
{
circular_progress_t self = vself;
self->visible = visible;
self->start = start;
self->value = current;
self->end = end;
}
static struct grub_gui_component_ops circprog_ops =
{
.destroy = circprog_destroy,

View file

@ -46,8 +46,10 @@ struct grub_gui_label
char *id;
int visible;
char *text;
char *template;
grub_font_t font;
grub_gui_color_t color;
int value;
enum align_mode align;
};
@ -57,7 +59,9 @@ static void
label_destroy (void *vself)
{
grub_gui_label_t self = vself;
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
grub_free (self->text);
grub_free (self->template);
grub_free (self);
}
@ -146,6 +150,17 @@ label_get_minimal_size (void *vself, unsigned *width, unsigned *height)
+ grub_font_get_descent (self->font));
}
static void
label_set_state (void *vself, int visible, int start __attribute__ ((unused)),
int current, int end __attribute__ ((unused)))
{
grub_gui_label_t self = vself;
self->value = -current;
self->visible = visible;
grub_free (self->text);
self->text = grub_xasprintf (self->template ? : "%d", self->value);
}
static grub_err_t
label_set_property (void *vself, const char *name, const char *value)
{
@ -153,9 +168,17 @@ label_set_property (void *vself, const char *name, const char *value)
if (grub_strcmp (name, "text") == 0)
{
grub_free (self->text);
grub_free (self->template);
if (! value)
value = "";
self->text = grub_strdup (value);
{
self->template = NULL;
self->text = grub_strdup ("");
}
else
{
self->template = grub_strdup (value);
self->text = grub_xasprintf (value, self->value);
}
}
else if (grub_strcmp (name, "font") == 0)
{
@ -183,11 +206,16 @@ label_set_property (void *vself, const char *name, const char *value)
}
else if (grub_strcmp (name, "id") == 0)
{
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
grub_free (self->id);
if (value)
self->id = grub_strdup (value);
else
self->id = 0;
if (self->id && grub_strcmp (self->id, GRUB_GFXMENU_TIMEOUT_COMPONENT_ID)
== 0)
grub_gfxmenu_timeout_register ((grub_gui_component_t) self,
label_set_state);
}
return GRUB_ERR_NONE;
}

View file

@ -60,6 +60,7 @@ static void
progress_bar_destroy (void *vself)
{
grub_gui_progress_bar_t self = vself;
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
grub_free (self);
}
@ -333,11 +334,16 @@ progress_bar_set_property (void *vself, const char *name, const char *value)
}
else if (grub_strcmp (name, "id") == 0)
{
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
grub_free (self->id);
if (value)
self->id = grub_strdup (value);
else
self->id = 0;
/* if (self->id && grub_strcmp (self->id, GRUB_GFXMENU_TIMEOUT_COMPONENT_ID)
== 0)*/
grub_gfxmenu_timeout_register ((grub_gui_component_t) self,
progress_bar_set_state);
}
return grub_errno;
}
@ -368,6 +374,7 @@ grub_gui_progress_bar_new (void)
self = grub_zalloc (sizeof (*self));
if (! self)
return 0;
self->progress.ops = &progress_bar_pb_ops;
self->progress.component.ops = &progress_bar_ops;
self->visible = 1;

View file

@ -37,10 +37,6 @@
#include <grub/gui_string_util.h>
#include <grub/icon_manager.h>
/* The component ID identifying GUI components to be updated as the timeout
status changes. */
#define TIMEOUT_COMPONENT_ID "__timeout__"
static void
init_terminal (grub_gfxmenu_view_t view);
static grub_video_rect_t term_rect;
@ -166,16 +162,28 @@ struct progress_value_data
int value;
};
static void
update_timeout_visit (grub_gui_component_t component,
void *userdata)
{
struct progress_value_data *pv;
pv = (struct progress_value_data *) userdata;
struct grub_gfxmenu_timeout_notify *grub_gfxmenu_timeout_notifications;
((struct grub_gui_progress *) component)->ops
->set_state ((struct grub_gui_progress *) component,
pv->visible, pv->start, pv->value, pv->end);
static void
update_timeouts (int visible, int start, int value, int end)
{
struct grub_gfxmenu_timeout_notify *cur;
for (cur = grub_gfxmenu_timeout_notifications; cur; cur = cur->next)
cur->set_state (cur->self, visible, start, value, end);
}
static void
redraw_timeouts (struct grub_gfxmenu_view *view)
{
struct grub_gfxmenu_timeout_notify *cur;
for (cur = grub_gfxmenu_timeout_notifications; cur; cur = cur->next)
{
grub_video_rect_t bounds;
cur->self->ops->get_bounds (cur->self, &bounds);
grub_gfxmenu_view_redraw (view, &bounds);
}
}
void
@ -183,67 +191,26 @@ grub_gfxmenu_print_timeout (int timeout, void *data)
{
struct grub_gfxmenu_view *view = data;
struct progress_value_data pv;
auto void redraw_timeout_visit (grub_gui_component_t component,
void *userdata __attribute__ ((unused)));
auto void redraw_timeout_visit (grub_gui_component_t component,
void *userdata __attribute__ ((unused)))
{
grub_video_rect_t bounds;
component->ops->get_bounds (component, &bounds);
grub_gfxmenu_view_redraw (view, &bounds);
}
if (view->first_timeout == -1)
view->first_timeout = timeout;
pv.visible = 1;
pv.start = -(view->first_timeout + 1);
pv.end = 0;
pv.value = -timeout;
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
TIMEOUT_COMPONENT_ID, update_timeout_visit, &pv);
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
TIMEOUT_COMPONENT_ID, redraw_timeout_visit, &pv);
update_timeouts (1, -(view->first_timeout + 1), -timeout, 0);
redraw_timeouts (view);
grub_video_swap_buffers ();
if (view->double_repaint)
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
TIMEOUT_COMPONENT_ID, redraw_timeout_visit, &pv);
redraw_timeouts (view);
}
void
grub_gfxmenu_clear_timeout (void *data)
{
struct progress_value_data pv;
struct grub_gfxmenu_view *view = data;
auto void redraw_timeout_visit (grub_gui_component_t component,
void *userdata __attribute__ ((unused)));
auto void redraw_timeout_visit (grub_gui_component_t component,
void *userdata __attribute__ ((unused)))
{
grub_video_rect_t bounds;
component->ops->get_bounds (component, &bounds);
grub_gfxmenu_view_redraw (view, &bounds);
}
pv.visible = 0;
pv.start = 1;
pv.end = 0;
pv.value = 0;
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
TIMEOUT_COMPONENT_ID, update_timeout_visit, &pv);
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
TIMEOUT_COMPONENT_ID, redraw_timeout_visit, &pv);
update_timeouts (0, 1, 0, 0);
redraw_timeouts (view);
grub_video_swap_buffers ();
if (view->double_repaint)
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
TIMEOUT_COMPONENT_ID, redraw_timeout_visit, &pv);
redraw_timeouts (view);
}
static void

View file

@ -96,23 +96,8 @@ void grub_dl_unload_all (void);
#else
#define GRUB_NO_MODULES 0
#endif
#if GRUB_NO_MODULES
static inline int
grub_dl_ref (grub_dl_t mod)
{
(void) mod;
return 0;
}
static inline int
grub_dl_unref (grub_dl_t mod)
{
(void) mod;
return 0;
}
#else
int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
#endif
void EXPORT_FUNC(grub_dl_iterate) (int (*hook) (grub_dl_t mod));
grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name);
grub_err_t grub_dl_register_symbol (const char *name, void *addr,

View file

@ -99,12 +99,8 @@ struct grub_pe32_optional_header
grub_uint32_t entry_addr;
grub_uint32_t code_base;
#if GRUB_TARGET_SIZEOF_VOID_P == 4
grub_uint32_t data_base;
grub_uint32_t image_base;
#else
grub_uint64_t image_base;
#endif
grub_uint32_t section_alignment;
grub_uint32_t file_alignment;
@ -121,22 +117,11 @@ struct grub_pe32_optional_header
grub_uint16_t subsystem;
grub_uint16_t dll_characteristics;
#if GRUB_TARGET_SIZEOF_VOID_P == 4
grub_uint32_t stack_reserve_size;
grub_uint32_t stack_commit_size;
grub_uint32_t heap_reserve_size;
grub_uint32_t heap_commit_size;
#else
grub_uint64_t stack_reserve_size;
grub_uint64_t stack_commit_size;
grub_uint64_t heap_reserve_size;
grub_uint64_t heap_commit_size;
#endif
grub_uint32_t loader_flags;
grub_uint32_t num_data_directories;
@ -159,15 +144,63 @@ struct grub_pe32_optional_header
struct grub_pe32_data_directory reserved_entry;
};
#if GRUB_TARGET_SIZEOF_VOID_P == 4
struct grub_pe64_optional_header
{
grub_uint16_t magic;
grub_uint8_t major_linker_version;
grub_uint8_t minor_linker_version;
grub_uint32_t code_size;
grub_uint32_t data_size;
grub_uint32_t bss_size;
grub_uint32_t entry_addr;
grub_uint32_t code_base;
grub_uint64_t image_base;
grub_uint32_t section_alignment;
grub_uint32_t file_alignment;
grub_uint16_t major_os_version;
grub_uint16_t minor_os_version;
grub_uint16_t major_image_version;
grub_uint16_t minor_image_version;
grub_uint16_t major_subsystem_version;
grub_uint16_t minor_subsystem_version;
grub_uint32_t reserved;
grub_uint32_t image_size;
grub_uint32_t header_size;
grub_uint32_t checksum;
grub_uint16_t subsystem;
grub_uint16_t dll_characteristics;
grub_uint64_t stack_reserve_size;
grub_uint64_t stack_commit_size;
grub_uint64_t heap_reserve_size;
grub_uint64_t heap_commit_size;
grub_uint32_t loader_flags;
grub_uint32_t num_data_directories;
/* Data directories. */
struct grub_pe32_data_directory export_table;
struct grub_pe32_data_directory import_table;
struct grub_pe32_data_directory resource_table;
struct grub_pe32_data_directory exception_table;
struct grub_pe32_data_directory certificate_table;
struct grub_pe32_data_directory base_relocation_table;
struct grub_pe32_data_directory debug;
struct grub_pe32_data_directory architecture;
struct grub_pe32_data_directory global_ptr;
struct grub_pe32_data_directory tls_table;
struct grub_pe32_data_directory load_config_table;
struct grub_pe32_data_directory bound_import;
struct grub_pe32_data_directory iat;
struct grub_pe32_data_directory delay_import_descriptor;
struct grub_pe32_data_directory com_runtime_header;
struct grub_pe32_data_directory reserved_entry;
};
#define GRUB_PE32_PE32_MAGIC 0x10b
#else
#define GRUB_PE32_PE32_MAGIC 0x20b
#endif
#define GRUB_PE32_PE64_MAGIC 0x20b
#define GRUB_PE32_SUBSYSTEM_EFI_APPLICATION 10
@ -205,6 +238,7 @@ struct grub_pe32_section_table
#define GRUB_PE32_SCN_ALIGN_SHIFT 20
#define GRUB_PE32_SCN_ALIGN_MASK 7
#define GRUB_PE32_SIGNATURE_SIZE 4
struct grub_pe32_header
{
@ -212,13 +246,18 @@ struct grub_pe32_header
grub_uint8_t msdos_stub[GRUB_PE32_MSDOS_STUB_SIZE];
/* This is always PE\0\0. */
char signature[4];
char signature[GRUB_PE32_SIGNATURE_SIZE];
/* The COFF file header. */
struct grub_pe32_coff_header coff_header;
#if GRUB_TARGET_SIZEOF_VOID_P == 8
/* The Optional header. */
struct grub_pe64_optional_header optional_header;
#else
/* The Optional header. */
struct grub_pe32_optional_header optional_header;
#endif
};
struct grub_pe32_fixup_block

View file

@ -555,6 +555,7 @@ typedef struct
#define PT_NUM 8 /* Number of defined types */
#define PT_LOOS 0x60000000 /* Start of OS-specific */
#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
#define PT_GNU_STACK 0x6474e551 /* GCC stack segment */
#define PT_LOSUNW 0x6ffffffa
#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */

View file

@ -26,7 +26,6 @@ enum grub_dev_abstraction_types {
};
char *grub_guess_root_device (const char *dir);
char *grub_get_prefix (const char *dir);
int grub_util_get_dev_abstraction (const char *os_dev);
char *grub_util_get_grub_dev (const char *os_dev);
const char *grub_util_check_block_device (const char *blk_dev);

50
include/grub/emu/misc.h Normal file
View file

@ -0,0 +1,50 @@
#ifndef GRUB_EMU_MISC_H
#define GRUB_EMU_MISC_H 1
#include <grub/symbol.h>
#include <grub/types.h>
#ifdef __CYGWIN__
# include <sys/fcntl.h>
# include <sys/cygwin.h>
# include <limits.h>
# define DEV_CYGDRIVE_MAJOR 98
#endif
#ifdef __NetBSD__
/* NetBSD uses /boot for its boot block. */
# define DEFAULT_DIRECTORY "/grub"
#else
# define DEFAULT_DIRECTORY "/boot/grub"
#endif
#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
extern int verbosity;
extern const char *program_name;
void grub_init_all (void);
void grub_fini_all (void);
char *grub_make_system_path_relative_to_its_root (const char *path);
void * EXPORT_FUNC(xmalloc) (grub_size_t size);
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size);
char * EXPORT_FUNC(xstrdup) (const char *str);
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...);
void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...);
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...);
void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((noreturn));
#ifndef HAVE_VASPRINTF
int EXPORT_FUNC(vasprintf) (char **buf, const char *fmt, va_list ap);
#endif
#ifndef HAVE_ASPRINTF
int EXPORT_FUNC(asprintf) (char **buf, const char *fmt, ...);
#endif
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...);
#endif /* GRUB_EMU_MISC_H */

View file

@ -22,10 +22,15 @@
#include <grub/video.h>
#include <grub/bitmap.h>
#include <grub/gfxmenu_view.h>
#include <grub/mm.h>
#ifndef GRUB_GUI_H
#define GRUB_GUI_H 1
/* The component ID identifying GUI components to be updated as the timeout
status changes. */
#define GRUB_GFXMENU_TIMEOUT_COMPONENT_ID "__timeout__"
/* A representation of a color. Unlike grub_video_color_t, this
representation is independent of any video mode specifics. */
typedef struct grub_gui_color
@ -79,6 +84,46 @@ struct grub_gui_progress_ops
void (*set_state) (void *self, int visible, int start, int current, int end);
};
typedef void (*grub_gfxmenu_set_state_t) (void *self, int visible, int start,
int current, int end);
struct grub_gfxmenu_timeout_notify
{
struct grub_gfxmenu_timeout_notify *next;
grub_gfxmenu_set_state_t set_state;
grub_gui_component_t self;
};
extern struct grub_gfxmenu_timeout_notify *grub_gfxmenu_timeout_notifications;
static inline grub_err_t
grub_gfxmenu_timeout_register (grub_gui_component_t self,
grub_gfxmenu_set_state_t set_state)
{
struct grub_gfxmenu_timeout_notify *ne = grub_malloc (sizeof (*ne));
if (!ne)
return grub_errno;
ne->set_state = set_state;
ne->self = self;
ne->next = grub_gfxmenu_timeout_notifications;
grub_gfxmenu_timeout_notifications = ne;
return GRUB_ERR_NONE;
}
static inline void
grub_gfxmenu_timeout_unregister (grub_gui_component_t self)
{
struct grub_gfxmenu_timeout_notify **p, *q;
for (p = &grub_gfxmenu_timeout_notifications, q = *p;
q; p = &(q->next), q = q->next)
if (q->self == self)
{
*p = q->next;
break;
}
}
typedef signed grub_fixed_signed_t;
#define GRUB_FIXED_1 0x10000

View file

@ -42,17 +42,33 @@ extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
On pre-ANSI systems without 'const', the config.h file is supposed to
contain "#define const". */
# ifdef GRUB_UTIL
# define gettext(Msgid) ((const char *) (Msgid))
static inline const char * __attribute__ ((always_inline))
gettext (const char *str)
{
return str;
}
# else
# define grub_gettext(str) ((const char *) (str))
static inline const char * __attribute__ ((always_inline))
grub_gettext (const char *str)
{
return str;
}
# endif /* GRUB_UTIL */
#endif /* (defined(ENABLE_NLS) && ENABLE_NLS) */
#ifdef GRUB_UTIL
# define _(str) gettext(str)
static inline const char * __attribute__ ((always_inline))
_ (const char *str)
{
return gettext(str);
}
#else
# define _(str) grub_gettext(str)
static inline const char * __attribute__ ((always_inline))
_ (const char *str)
{
return grub_gettext(str);
}
#endif /* GRUB_UTIL */
#define N_(str) str

View file

@ -1,28 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_KERNEL_MACHINE_HEADER
#define GRUB_KERNEL_MACHINE_HEADER 1
#include <grub/symbol.h>
#ifndef ASM_FILE
extern char grub_prefix[];
#endif
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */

View file

@ -44,8 +44,9 @@ typedef struct grub_linuxbios_table_header *grub_linuxbios_table_header_t;
struct grub_linuxbios_table_item
{
#define GRUB_LINUXBIOS_MEMBER_UNUSED 0
#define GRUB_LINUXBIOS_MEMBER_MEMORY 1
#define GRUB_LINUXBIOS_MEMBER_UNUSED 0x00
#define GRUB_LINUXBIOS_MEMBER_MEMORY 0x01
#define GRUB_LINUXBIOS_MEMBER_LINK 0x11
grub_uint32_t tag;
grub_uint32_t size;
};

View file

@ -1,33 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_KERNEL_HEADER
#define GRUB_MACHINE_KERNEL_HEADER 1
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char grub_prefix[];
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_MACHINE_PREFIX 0x8
/* End of the data section. */
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
#endif /* ! GRUB_MACHINE_KERNEL_HEADER */

View file

@ -1 +0,0 @@
#include <grub/powerpc/ieee1275/kernel.h>

View file

@ -1,35 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_KERNEL_CPU_HEADER
#define GRUB_KERNEL_CPU_HEADER 1
#ifdef GRUB_MACHINE_IEEE1275
#define GRUB_MOD_ALIGN 0x1000
#else
#define GRUB_MOD_ALIGN 0x1
#endif
/* Non-zero value is only needed for PowerMacs. */
#define GRUB_MOD_GAP 0x0
#define GRUB_KERNEL_CPU_PREFIX 0x2
#define GRUB_KERNEL_CPU_DATA_END 0x42
#endif

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/boot.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/console.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/init.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/kernel.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/loader.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/memory.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/serial.h>

View file

@ -0,0 +1 @@
#include <grub/i386/coreboot/time.h>

View file

@ -19,6 +19,8 @@
#ifndef GRUB_BOOT_MACHINE_HEADER
#define GRUB_BOOT_MACHINE_HEADER 1
#include <grub/offsets.h>
/* The signature for bootloader. */
#define GRUB_BOOT_MACHINE_SIGNATURE 0xaa55
@ -57,9 +59,6 @@
floppy. */
#define GRUB_BOOT_MACHINE_BIOS_HD_FLAG 0x80
/* The segment where the kernel is loaded. */
#define GRUB_BOOT_MACHINE_KERNEL_SEG 0x800
/* The address where the kernel is loaded. */
#define GRUB_BOOT_MACHINE_KERNEL_ADDR (GRUB_BOOT_MACHINE_KERNEL_SEG << 4)
@ -68,16 +67,7 @@
#define GRUB_BOOT_MACHINE_PXE_DL 0x7f
#ifndef ASM_FILE
/* This is the blocklist used in the diskboot image. */
struct grub_boot_blocklist
{
grub_uint64_t start;
grub_uint16_t len;
grub_uint16_t segment;
} __attribute__ ((packed));
#endif /* ! ASM_FILE */
#define grub_boot_blocklist grub_pc_bios_boot_blocklist
#endif /* ! BOOT_MACHINE_HEADER */

View file

@ -19,29 +19,7 @@
#ifndef KERNEL_MACHINE_HEADER
#define KERNEL_MACHINE_HEADER 1
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE 0x8
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc
/* The offset of GRUB_COMPRESSED_SIZE. */
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE 0x10
/* The offset of GRUB_INSTALL_DOS_PART. */
#define GRUB_KERNEL_MACHINE_INSTALL_DOS_PART 0x14
/* The offset of GRUB_INSTALL_BSD_PART. */
#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART 0x18
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_MACHINE_PREFIX 0x1c
/* End of the data section. */
#define GRUB_KERNEL_MACHINE_DATA_END 0x5c
/* The size of the first region which won't be compressed. */
#define GRUB_KERNEL_MACHINE_RAW_SIZE (GRUB_KERNEL_MACHINE_DATA_END + 0x5F0)
#include <grub/offsets.h>
/* Enable LZMA compression */
#define ENABLE_LZMA 1
@ -63,10 +41,6 @@ extern grub_int32_t grub_install_dos_part;
/* The BSD partition number of the installed partition. */
extern grub_int32_t grub_install_bsd_part;
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char grub_prefix[];
/* The boot BIOS drive number. */
extern grub_uint8_t EXPORT_VAR(grub_boot_drive);

View file

@ -29,6 +29,8 @@
#include <grub/i386/memory.h>
#include <grub/offsets.h>
/* The scratch buffer used in real mode code. */
#define GRUB_MEMORY_MACHINE_SCRATCH_ADDR 0x68000
#define GRUB_MEMORY_MACHINE_SCRATCH_SEG (GRUB_MEMORY_MACHINE_SCRATCH_ADDR >> 4)
@ -40,9 +42,6 @@
/* The size of the protect mode stack. */
#define GRUB_MEMORY_MACHINE_PROT_STACK_SIZE 0x8000
/* The upper memory area (starting at 640 kiB). */
#define GRUB_MEMORY_MACHINE_UPPER 0xa0000
/* The protected mode stack. */
#define GRUB_MEMORY_MACHINE_PROT_STACK \
(GRUB_MEMORY_MACHINE_SCRATCH_ADDR + GRUB_MEMORY_MACHINE_SCRATCH_SIZE \

View file

@ -22,7 +22,4 @@
/* The size of boot.img. */
#define GRUB_BOOT_MACHINE_SIZE (0x100000 - GRUB_BOOT_MACHINE_LINK_ADDR)
/* The offset of GRUB_CORE_ENTRY_ADDR. */
#define GRUB_BOOT_MACHINE_CORE_ENTRY_ADDR 0x4
#endif

View file

@ -19,17 +19,7 @@
#ifndef GRUB_KERNEL_MACHINE_HEADER
#define GRUB_KERNEL_MACHINE_HEADER 1
/* The offset of GRUB_CORE_ENTRY_ADDR. */
#define GRUB_KERNEL_MACHINE_CORE_ENTRY_ADDR 0x8
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_MACHINE_PREFIX 0x10
/* End of the data section. */
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
#include <grub/offsets.h>
#ifndef ASM_FILE
@ -44,10 +34,6 @@ extern grub_int32_t grub_kernel_image_size;
/* The total size of module images following the kernel. */
extern grub_int32_t grub_total_module_size;
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char grub_prefix[];
#endif /* ! ASM_FILE */
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */

View file

@ -100,6 +100,9 @@ enum grub_ieee1275_flag
/* Open Hack'Ware don't support the ANSI sequence. */
GRUB_IEEE1275_FLAG_NO_ANSI,
/* OpenFirmware hangs on qemu if one requests any memory below 1.5 MiB. */
GRUB_IEEE1275_FLAG_NO_PRE1_5M_CLAIM,
};
extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag);

View file

@ -42,19 +42,33 @@ struct grub_module_header
/* "gmim" (GRUB Module Info Magic). */
#define GRUB_MODULE_MAGIC 0x676d696d
struct grub_module_info
struct grub_module_info32
{
/* Magic number so we know we have modules present. */
grub_uint32_t magic;
#if GRUB_TARGET_SIZEOF_VOID_P == 8
grub_uint32_t padding;
#endif
/* The offset of the modules. */
grub_target_off_t offset;
grub_uint32_t offset;
/* The size of all modules plus this header. */
grub_target_size_t size;
grub_uint32_t size;
};
struct grub_module_info64
{
/* Magic number so we know we have modules present. */
grub_uint32_t magic;
grub_uint32_t padding;
/* The offset of the modules. */
grub_uint64_t offset;
/* The size of all modules plus this header. */
grub_uint64_t size;
};
#if GRUB_TARGET_SIZEOF_VOID_P == 8
#define grub_module_info grub_module_info64
#else
#define grub_module_info grub_module_info32
#endif
extern grub_addr_t grub_arch_modules_addr (void);
extern void EXPORT_FUNC(grub_module_iterate) (int (*hook) (struct grub_module_header *));
@ -76,4 +90,8 @@ void grub_machine_set_prefix (void);
/* Register all the exported symbols. This is automatically generated. */
void grub_register_exported_symbols (void);
#if ! defined (ASM_FILE) && !defined (GRUB_MACHINE_EMU)
extern char grub_prefix[];
#endif
#endif /* ! GRUB_KERNEL_HEADER */

View file

@ -47,6 +47,8 @@ struct grub_menu_entry
/* The sourcecode of the menu entry, used by the editor. */
const char *sourcecode;
int hotkey;
/* The next element. */
struct grub_menu_entry *next;
};

View file

@ -1,65 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_KERNEL_CPU_HEADER
#define GRUB_KERNEL_CPU_HEADER 1
#define GRUB_MOD_ALIGN 0x1
/* Non-zero value is only needed for PowerMacs. */
#define GRUB_MOD_GAP 0x0
#define GRUB_KERNEL_MACHINE_LINK_ALIGN 32
#define GRUB_KERNEL_CPU_RAW_SIZE 0x200
#define GRUB_KERNEL_CPU_COMPRESSED_SIZE 0x8
#define GRUB_KERNEL_CPU_TOTAL_MODULE_SIZE 0xc
#define GRUB_KERNEL_CPU_KERNEL_IMAGE_SIZE 0x10
#define GRUB_KERNEL_CPU_PREFIX GRUB_KERNEL_CPU_RAW_SIZE
#define GRUB_KERNEL_CPU_DATA_END GRUB_KERNEL_CPU_RAW_SIZE + 0x48
#define GRUB_KERNEL_MACHINE_RAW_SIZE GRUB_KERNEL_CPU_RAW_SIZE
#define GRUB_KERNEL_MACHINE_PREFIX GRUB_KERNEL_CPU_PREFIX
#define GRUB_KERNEL_MACHINE_DATA_END GRUB_KERNEL_CPU_DATA_END
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE GRUB_KERNEL_CPU_KERNEL_IMAGE_SIZE
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE GRUB_KERNEL_CPU_TOTAL_MODULE_SIZE
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE GRUB_KERNEL_CPU_COMPRESSED_SIZE
#define GRUB_PLATFORM_IMAGE_FORMATS "raw, elf"
#define GRUB_PLATFORM_IMAGE_DEFAULT_FORMAT "raw"
#define GRUB_PLATFORM_IMAGE_DEFAULT GRUB_PLATFORM_IMAGE_RAW
#ifndef ASM_FILE
typedef enum {
GRUB_PLATFORM_IMAGE_RAW,
GRUB_PLATFORM_IMAGE_ELF
}
grub_platform_image_format_t;
#define GRUB_PLATFORM_IMAGE_RAW GRUB_PLATFORM_IMAGE_RAW
#define GRUB_PLATFORM_IMAGE_ELF GRUB_PLATFORM_IMAGE_ELF
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char grub_prefix[];
#endif
#endif

View file

@ -27,10 +27,6 @@
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_halt) (void);
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char grub_prefix[];
#endif
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */

View file

@ -20,7 +20,6 @@
#define GRUB_KERNEL_MACHINE_HEADER 1
#include <grub/symbol.h>
#include <grub/cpu/kernel.h>
#ifndef ASM_FILE

View file

@ -49,7 +49,7 @@ void grub_multiboot_set_bootdev (void);
grub_uint32_t grub_get_multiboot_mmap_count (void);
grub_err_t grub_multiboot_set_video_mode (void);
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
#if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
#include <grub/i386/pc/vbe.h>
#define GRUB_MACHINE_HAS_VGA_TEXT 1
#else

173
include/grub/offsets.h Normal file
View file

@ -0,0 +1,173 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OFFSETS_HEADER
#define OFFSETS_HEADER 1
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
#define GRUB_KERNEL_I386_PC_TOTAL_MODULE_SIZE 0x8
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
#define GRUB_KERNEL_I386_PC_KERNEL_IMAGE_SIZE 0xc
/* The offset of GRUB_COMPRESSED_SIZE. */
#define GRUB_KERNEL_I386_PC_COMPRESSED_SIZE 0x10
/* The offset of GRUB_INSTALL_DOS_PART. */
#define GRUB_KERNEL_I386_PC_INSTALL_DOS_PART 0x14
/* The offset of GRUB_INSTALL_BSD_PART. */
#define GRUB_KERNEL_I386_PC_INSTALL_BSD_PART 0x18
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_I386_PC_PREFIX 0x1c
/* End of the data section. */
#define GRUB_KERNEL_I386_PC_DATA_END 0x5c
/* The size of the first region which won't be compressed. */
#define GRUB_KERNEL_I386_PC_RAW_SIZE (GRUB_KERNEL_I386_PC_DATA_END + 0x5F0)
/* The segment where the kernel is loaded. */
#define GRUB_BOOT_I386_PC_KERNEL_SEG 0x800
#define GRUB_KERNEL_I386_PC_LINK_ADDR 0x8200
/* The upper memory area (starting at 640 kiB). */
#define GRUB_MEMORY_I386_PC_UPPER 0xa0000
#define GRUB_MEMORY_I386_QEMU_UPPER GRUB_MEMORY_I386_PC_UPPER
/* The offset of GRUB_CORE_ENTRY_ADDR. */
#define GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR 0x4
/* The offset of GRUB_CORE_ENTRY_ADDR. */
#define GRUB_KERNEL_I386_QEMU_CORE_ENTRY_ADDR 0x8
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
#define GRUB_KERNEL_I386_QEMU_KERNEL_IMAGE_SIZE 0xc
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_I386_QEMU_PREFIX 0x10
/* End of the data section. */
#define GRUB_KERNEL_I386_QEMU_DATA_END 0x50
#define GRUB_KERNEL_I386_QEMU_LINK_ADDR 0x8200
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
#define GRUB_KERNEL_SPARC64_IEEE1275_TOTAL_MODULE_SIZE 0x8
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
#define GRUB_KERNEL_SPARC64_IEEE1275_KERNEL_IMAGE_SIZE 0xc
/* The offset of GRUB_COMPRESSED_SIZE. */
#define GRUB_KERNEL_SPARC64_IEEE1275_COMPRESSED_SIZE 0x10
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_SPARC64_IEEE1275_PREFIX 0x14
/* End of the data section. */
#define GRUB_KERNEL_SPARC64_IEEE1275_DATA_END 0x114
#define GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE 12
#define GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS 0x4400
#define GRUB_KERNEL_SPARC64_IEEE1275_RAW_SIZE 0
#define GRUB_KERNEL_SPARC64_IEEE1275_LINK_ADDR 0x4400
#define GRUB_KERNEL_POWERPC_IEEE1275_PREFIX 0x4
#define GRUB_KERNEL_POWERPC_IEEE1275_DATA_END 0x44
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ALIGN 4
#define GRUB_KERNEL_POWERPC_IEEE1275_LINK_ADDR 0x200000
#define GRUB_KERNEL_MIPS_YEELOONG_LINK_ADDR 0x80200000
#define GRUB_KERNEL_MIPS_YEELOONG_LINK_ALIGN 32
#define GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE 0x200
#define GRUB_KERNEL_MIPS_YEELOONG_COMPRESSED_SIZE 0x8
#define GRUB_KERNEL_MIPS_YEELOONG_TOTAL_MODULE_SIZE 0xc
#define GRUB_KERNEL_MIPS_YEELOONG_KERNEL_IMAGE_SIZE 0x10
#define GRUB_KERNEL_MIPS_YEELOONG_PREFIX GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE
#define GRUB_KERNEL_MIPS_YEELOONG_DATA_END GRUB_KERNEL_MIPS_YEELOONG_RAW_SIZE + 0x48
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_I386_EFI_PREFIX 0x8
/* End of the data section. */
#define GRUB_KERNEL_I386_EFI_DATA_END 0x50
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_X86_64_EFI_PREFIX 0x8
/* End of the data section. */
#define GRUB_KERNEL_X86_64_EFI_DATA_END 0x50
#define GRUB_KERNEL_I386_COREBOOT_PREFIX 0x2
#define GRUB_KERNEL_I386_COREBOOT_DATA_END 0x42
#define GRUB_KERNEL_I386_COREBOOT_LINK_ADDR 0x8200
#define GRUB_KERNEL_I386_IEEE1275_PREFIX 0x2
#define GRUB_KERNEL_I386_IEEE1275_DATA_END 0x42
#define GRUB_KERNEL_I386_IEEE1275_LINK_ADDR 0x10000
#define GRUB_KERNEL_I386_IEEE1275_MOD_ALIGN 0x1000
#define GRUB_KERNEL_I386_COREBOOT_MOD_ALIGN 0x1
/* Non-zero value is only needed for PowerMacs. */
#define GRUB_KERNEL_I386_IEEE1275_MOD_GAP 0x0
#define GRUB_KERNEL_I386_COREBOOT_MOD_GAP 0x0
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_ALIGN 0x1000
#define GRUB_KERNEL_MIPS_YEELOONG_MOD_ALIGN 0x1
/* Minimal gap between _end and the start of the modules. It's a hack
for PowerMac to prevent "CLAIM failed" error. The real fix is to
rewrite grub-mkimage to generate valid ELF files. */
#define GRUB_KERNEL_POWERPC_IEEE1275_MOD_GAP 0x8000
#ifdef MACHINE
#define GRUB_OFFSETS_CONCAT_(a,b,c) a ## b ## c
#define GRUB_OFFSETS_CONCAT(a,b,c) GRUB_OFFSETS_CONCAT_(a,b,c)
#define GRUB_KERNEL_MACHINE_MOD_ALIGN GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _MOD_ALIGN)
#define GRUB_KERNEL_MACHINE_MOD_GAP GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _MOD_GAP)
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _TOTAL_MODULE_SIZE)
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _KERNEL_IMAGE_SIZE)
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _COMPRESSED_SIZE)
#define GRUB_KERNEL_MACHINE_PREFIX GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _PREFIX)
#define GRUB_KERNEL_MACHINE_DATA_END GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _DATA_END)
#define GRUB_BOOT_MACHINE_KERNEL_SEG GRUB_OFFSETS_CONCAT (GRUB_BOOT_, MACHINE, _KERNEL_SEG)
#define GRUB_MEMORY_MACHINE_UPPER GRUB_OFFSETS_CONCAT (GRUB_MEMORY_, MACHINE, _UPPER)
#define GRUB_KERNEL_MACHINE_RAW_SIZE GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _RAW_SIZE)
#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _INSTALL_BSD_PART)
#define GRUB_KERNEL_MACHINE_INSTALL_DOS_PART GRUB_OFFSETS_CONCAT (GRUB_KERNEL_, MACHINE, _INSTALL_DOS_PART)
#endif
#ifndef ASM_FILE
struct grub_pc_bios_boot_blocklist
{
grub_uint64_t start;
grub_uint16_t len;
grub_uint16_t segment;
} __attribute__ ((packed));
#endif
#endif

View file

@ -1,32 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_KERNEL_MACHINE_HEADER
#define GRUB_KERNEL_MACHINE_HEADER 1
#include <grub/symbol.h>
#ifndef ASM_FILE
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char grub_prefix[];
#endif
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */

View file

@ -19,14 +19,4 @@
#ifndef GRUB_KERNEL_CPU_HEADER
#define GRUB_KERNEL_CPU_HEADER 1
#define GRUB_MOD_ALIGN 0x1000
/* Minimal gap between _end and the start of the modules. It's a hack
for PowerMac to prevent "CLAIM failed" error. The real fix is to
rewrite grub-mkimage to generate valid ELF files. */
#define GRUB_MOD_GAP 0x8000
#define GRUB_KERNEL_CPU_PREFIX 0x4
#define GRUB_KERNEL_CPU_DATA_END 0x44
#endif

View file

@ -67,6 +67,13 @@ struct grub_script_arg
struct grub_script_arg *next;
};
/* An argument vector. */
struct grub_script_argv
{
unsigned argc;
char **args;
};
/* A complete argument. It consists of a list of one or more `struct
grub_script_arg's. */
struct grub_script_arglist
@ -86,15 +93,6 @@ struct grub_script_cmdline
struct grub_script_arglist *arglist;
};
/* A block of commands, this can be used to group commands. */
struct grub_script_cmdblock
{
struct grub_script_cmd cmd;
/* A chain of commands. */
struct grub_script_cmd *cmdlist;
};
/* An if statement. */
struct grub_script_cmdif
{
@ -228,6 +226,11 @@ struct grub_parser_param
struct grub_lexer_param *lexerstate;
};
void grub_script_argv_free (struct grub_script_argv *argv);
int grub_script_argv_next (struct grub_script_argv *argv);
int grub_script_argv_append (struct grub_script_argv *argv, const char *s);
int grub_script_argv_split_append (struct grub_script_argv *argv, char *s);
struct grub_script_arglist *
grub_script_create_arglist (struct grub_parser_param *state);
@ -238,8 +241,6 @@ grub_script_add_arglist (struct grub_parser_param *state,
struct grub_script_cmd *
grub_script_create_cmdline (struct grub_parser_param *state,
struct grub_script_arglist *arglist);
struct grub_script_cmd *
grub_script_create_cmdblock (struct grub_parser_param *state);
struct grub_script_cmd *
grub_script_create_cmdif (struct grub_parser_param *state,
@ -266,9 +267,9 @@ grub_script_create_cmdmenu (struct grub_parser_param *state,
int options);
struct grub_script_cmd *
grub_script_add_cmd (struct grub_parser_param *state,
struct grub_script_cmdblock *cmdblock,
struct grub_script_cmd *cmd);
grub_script_append_cmd (struct grub_parser_param *state,
struct grub_script_cmd *list,
struct grub_script_cmd *last);
struct grub_script_arg *
grub_script_arg_add (struct grub_parser_param *state,
struct grub_script_arg *arg,
@ -305,7 +306,7 @@ void grub_script_yyerror (struct grub_parser_param *, char const *);
/* Commands to execute, don't use these directly. */
grub_err_t grub_script_execute_cmdline (struct grub_script_cmd *cmd);
grub_err_t grub_script_execute_cmdblock (struct grub_script_cmd *cmd);
grub_err_t grub_script_execute_cmdlist (struct grub_script_cmd *cmd);
grub_err_t grub_script_execute_cmdif (struct grub_script_cmd *cmd);
grub_err_t grub_script_execute_cmdfor (struct grub_script_cmd *cmd);
grub_err_t grub_script_execute_cmdwhile (struct grub_script_cmd *cmd);
@ -344,8 +345,8 @@ grub_script_function_t grub_script_function_create (struct grub_script_arg *func
void grub_script_function_remove (const char *name);
grub_script_function_t grub_script_function_find (char *functionname);
int grub_script_function_iterate (int (*iterate) (grub_script_function_t));
int grub_script_function_call (grub_script_function_t func,
int argc, char **args);
grub_err_t grub_script_function_call (grub_script_function_t func,
int argc, char **args);
char **
grub_script_execute_arglist_to_argv (struct grub_script_arglist *arglist, int *count);

View file

@ -50,10 +50,6 @@
#define GRUB_BOOT_MACHINE_CODE_END \
(0x1fc - GRUB_BOOT_AOUT_HEADER_SIZE)
#define GRUB_BOOT_MACHINE_LIST_SIZE 12
#define GRUB_BOOT_MACHINE_IMAGE_ADDRESS 0x4400
#define GRUB_BOOT_MACHINE_KERNEL_ADDR 0x4200
#endif /* ! BOOT_MACHINE_HEADER */

View file

@ -19,44 +19,10 @@
#ifndef GRUB_KERNEL_MACHINE_HEADER
#define GRUB_KERNEL_MACHINE_HEADER 1
#define GRUB_MOD_ALIGN 0x2000
/* Non-zero value is only needed for PowerMacs. */
#define GRUB_MOD_GAP 0x0
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE 0x8
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc
/* The offset of GRUB_COMPRESSED_SIZE. */
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE 0x10
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_MACHINE_PREFIX 0x14
/* End of the data section. */
#define GRUB_KERNEL_MACHINE_DATA_END 0x114
#define GRUB_KERNEL_MACHINE_RAW_SIZE 0
#define GRUB_KERNEL_MACHINE_STACK_SIZE 0x40000
#define GRUB_PLATFORM_IMAGE_FORMATS "raw, aout"
#define GRUB_PLATFORM_IMAGE_DEFAULT_FORMAT "raw"
#define GRUB_PLATFORM_IMAGE_DEFAULT GRUB_PLATFORM_IMAGE_RAW
#ifndef ASM_FILE
typedef enum {
GRUB_PLATFORM_IMAGE_RAW,
GRUB_PLATFORM_IMAGE_AOUT
}
grub_platform_image_format_t;
#define GRUB_PLATFORM_IMAGE_RAW GRUB_PLATFORM_IMAGE_RAW
#define GRUB_PLATFORM_IMAGE_AOUT GRUB_PLATFORM_IMAGE_AOUT
#include <grub/symbol.h>
#include <grub/types.h>
@ -66,10 +32,6 @@ extern grub_int32_t grub_kernel_image_size;
/* The total size of module images following the kernel. */
extern grub_int32_t grub_total_module_size;
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char grub_prefix[];
#endif /* ! ASM_FILE */
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */

View file

@ -1,30 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_KERNEL_CPU_HEADER
#define GRUB_KERNEL_CPU_HEADER 1
#define GRUB_MOD_ALIGN 0x2000
/* Non-zero value is only needed for PowerMacs. */
#define GRUB_MOD_GAP 0x0
#define GRUB_KERNEL_CPU_PREFIX 0x2
#define GRUB_KERNEL_CPU_DATA_END 0x42
#endif

View file

@ -178,21 +178,6 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
# define grub_be_to_cpu16(x) ((grub_uint16_t) (x))
# define grub_be_to_cpu32(x) ((grub_uint32_t) (x))
# define grub_be_to_cpu64(x) ((grub_uint64_t) (x))
# ifdef GRUB_TARGET_WORDS_BIGENDIAN
# define grub_target_to_host16(x) ((grub_uint16_t) (x))
# define grub_target_to_host32(x) ((grub_uint32_t) (x))
# define grub_target_to_host64(x) ((grub_uint64_t) (x))
# define grub_host_to_target16(x) ((grub_uint16_t) (x))
# define grub_host_to_target32(x) ((grub_uint32_t) (x))
# define grub_host_to_target64(x) ((grub_uint64_t) (x))
# else /* ! GRUB_TARGET_WORDS_BIGENDIAN */
# define grub_target_to_host16(x) grub_swap_bytes16(x)
# define grub_target_to_host32(x) grub_swap_bytes32(x)
# define grub_target_to_host64(x) grub_swap_bytes64(x)
# define grub_host_to_target16(x) grub_swap_bytes16(x)
# define grub_host_to_target32(x) grub_swap_bytes32(x)
# define grub_host_to_target64(x) grub_swap_bytes64(x)
# endif
#else /* ! WORDS_BIGENDIAN */
# define grub_cpu_to_le16(x) ((grub_uint16_t) (x))
# define grub_cpu_to_le32(x) ((grub_uint32_t) (x))
@ -206,27 +191,6 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
# define grub_be_to_cpu16(x) grub_swap_bytes16(x)
# define grub_be_to_cpu32(x) grub_swap_bytes32(x)
# define grub_be_to_cpu64(x) grub_swap_bytes64(x)
# ifdef GRUB_TARGET_WORDS_BIGENDIAN
# define grub_target_to_host16(x) grub_swap_bytes16(x)
# define grub_target_to_host32(x) grub_swap_bytes32(x)
# define grub_target_to_host64(x) grub_swap_bytes64(x)
# define grub_host_to_target16(x) grub_swap_bytes16(x)
# define grub_host_to_target32(x) grub_swap_bytes32(x)
# define grub_host_to_target64(x) grub_swap_bytes64(x)
# else /* ! GRUB_TARGET_WORDS_BIGENDIAN */
# define grub_target_to_host16(x) ((grub_uint16_t) (x))
# define grub_target_to_host32(x) ((grub_uint32_t) (x))
# define grub_target_to_host64(x) ((grub_uint64_t) (x))
# define grub_host_to_target16(x) ((grub_uint16_t) (x))
# define grub_host_to_target32(x) ((grub_uint32_t) (x))
# define grub_host_to_target64(x) ((grub_uint64_t) (x))
# endif
#endif /* ! WORDS_BIGENDIAN */
#if GRUB_TARGET_SIZEOF_VOID_P == 8
# define grub_host_to_target_addr(x) grub_host_to_target64(x)
#else
# define grub_host_to_target_addr(x) grub_host_to_target32(x)
#endif
#endif /* ! GRUB_TYPES_HEADER */

View file

@ -28,26 +28,7 @@
#include <config.h>
#include <grub/types.h>
#include <grub/symbol.h>
#ifdef __NetBSD__
/* NetBSD uses /boot for its boot block. */
# define DEFAULT_DIRECTORY "/grub"
#else
# define DEFAULT_DIRECTORY "/boot/grub"
#endif
#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
extern char *progname;
extern int verbosity;
void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...);
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...);
void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((noreturn));
void *xmalloc (size_t size);
void *xrealloc (void *ptr, size_t size);
char *xstrdup (const char *str);
#include <grub/emu/misc.h>
char *grub_util_get_path (const char *dir, const char *file);
size_t grub_util_get_fp_size (FILE *fp);
@ -59,20 +40,6 @@ void grub_util_write_image (const char *img, size_t size, FILE *out);
void grub_util_write_image_at (const void *img, size_t size, off_t offset,
FILE *out);
#ifndef HAVE_VASPRINTF
int vasprintf (char **buf, const char *fmt, va_list ap);
#endif
#ifndef HAVE_ASPRINTF
int asprintf (char **buf, const char *fmt, ...);
#endif
char *xasprintf (const char *fmt, ...);
#ifdef __MINGW32__
#define fseeko fseeko64

View file

@ -181,7 +181,8 @@ typedef enum grub_video_driver_id
GRUB_VIDEO_DRIVER_VBE,
GRUB_VIDEO_DRIVER_EFI_UGA,
GRUB_VIDEO_DRIVER_EFI_GOP,
GRUB_VIDEO_DRIVER_SM712
GRUB_VIDEO_DRIVER_SM712,
GRUB_VIDEO_DRIVER_VGA
} grub_video_driver_id_t;
struct grub_video_adapter

View file

@ -1,33 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2007 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_MACHINE_KERNEL_HEADER
#define GRUB_MACHINE_KERNEL_HEADER 1
/* The prefix which points to the directory where GRUB modules and its
configuration file are located. */
extern char grub_prefix[];
/* The offset of GRUB_PREFIX. */
#define GRUB_KERNEL_MACHINE_PREFIX 0x8
/* End of the data section. */
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
#endif /* ! GRUB_MACHINE_KERNEL_HEADER */

View file

@ -1 +0,0 @@
#include <grub/i386/kernel.h>

View file

@ -26,6 +26,7 @@
#include <grub/file.h>
#include <grub/device.h>
#include <grub/command.h>
#include <grub/i18n.h>
/* set ENVVAR=VALUE */
static grub_err_t
@ -178,11 +179,13 @@ void
grub_register_core_commands (void)
{
grub_register_command ("set", grub_core_cmd_set,
"[ENVVAR=VALUE]", "Set an environment variable.");
N_("[ENVVAR=VALUE]"),
N_("Set an environment variable."));
grub_register_command ("unset", grub_core_cmd_unset,
"ENVVAR", "Remove an environment variable.");
N_("ENVVAR"),
N_("Remove an environment variable."));
grub_register_command ("ls", grub_core_cmd_ls,
"[ARG]", "List devices or files.");
N_("[ARG]"), N_("List devices or files."));
grub_register_command ("insmod", grub_core_cmd_insmod,
"MODULE", "Insert a module.");
N_("MODULE"), N_("Insert a module."));
}

View file

@ -469,12 +469,14 @@ grub_dl_resolve_dependencies (grub_dl_t mod, Elf_Ehdr *e)
return GRUB_ERR_NONE;
}
#if !GRUB_NO_MODULES
int
grub_dl_ref (grub_dl_t mod)
{
grub_dl_dep_t dep;
if (!mod)
return 0;
for (dep = mod->dep; dep; dep = dep->next)
grub_dl_ref (dep->mod);
@ -486,12 +488,14 @@ grub_dl_unref (grub_dl_t mod)
{
grub_dl_dep_t dep;
if (!mod)
return 0;
for (dep = mod->dep; dep; dep = dep->next)
grub_dl_unref (dep->mod);
return --mod->ref_count;
}
#endif
static void
grub_dl_flush_cache (grub_dl_t mod)

View file

@ -24,7 +24,7 @@
#include <grub/misc.h>
#include <grub/env.h>
#include <grub/mm.h>
#include <grub/machine/kernel.h>
#include <grub/kernel.h>
void
grub_efi_init (void)
@ -42,39 +42,58 @@ grub_efi_init (void)
void
grub_efi_set_prefix (void)
{
grub_efi_loaded_image_t *image;
grub_efi_loaded_image_t *image = NULL;
char *device = NULL;
char *path = NULL;
image = grub_efi_get_loaded_image (grub_efi_image_handle);
if (image)
{
char *pptr = NULL;
if (grub_prefix[0] == '(')
{
pptr = grub_strrchr (grub_prefix, ')');
if (pptr)
{
device = grub_strndup (grub_prefix + 1, pptr - grub_prefix - 1);
pptr++;
}
}
if (!pptr)
pptr = grub_prefix;
if (pptr[0])
path = grub_strdup (pptr);
}
if (!device || !path)
image = grub_efi_get_loaded_image (grub_efi_image_handle);
if (image && !device)
device = grub_efidisk_get_device_name (image->device_handle);
if (image && !path)
{
char *device;
char *file;
char *p;
device = grub_efidisk_get_device_name (image->device_handle);
file = grub_efi_get_filename (image->file_path);
path = grub_efi_get_filename (image->file_path);
if (device && file)
{
char *p;
char *prefix;
/* Get the directory. */
p = grub_strrchr (file, '/');
if (p)
*p = '\0';
prefix = grub_xasprintf ("(%s)%s", device, file);
if (prefix)
{
grub_env_set ("prefix", prefix);
grub_free (prefix);
}
}
grub_free (device);
grub_free (file);
/* Get the directory. */
p = grub_strrchr (path, '/');
if (p)
*p = '\0';
}
if (device && path)
{
char *prefix;
prefix = grub_xasprintf ("(%s)%s", device, path);
if (prefix)
{
grub_env_set ("prefix", prefix);
grub_free (prefix);
}
}
grub_free (device);
grub_free (path);
}
void

View file

@ -27,7 +27,7 @@
# define A_STANDOUT 0
#endif /* ! A_STANDOUT */
#include <grub/util/console.h>
#include <grub/emu/console.h>
#include <grub/term.h>
#include <grub/types.h>

View file

@ -19,16 +19,15 @@
#include <config.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <dirent.h>
#ifdef __CYGWIN__
# include <sys/fcntl.h>
# include <sys/cygwin.h>
# include <limits.h>
# define DEV_CYGDRIVE_MAJOR 98
#endif
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef __GNU__
#include <hurd.h>
@ -36,9 +35,11 @@
#include <hurd/fs.h>
#endif
#include <grub/util/misc.h>
#include <grub/util/hostdisk.h>
#include <grub/util/getroot.h>
#include <grub/mm.h>
#include <grub/misc.h>
#include <grub/emu/misc.h>
#include <grub/emu/hostdisk.h>
#include <grub/emu/getroot.h>
static void
strip_extra_slashes (char *dir)
@ -79,103 +80,6 @@ xgetcwd (void)
return path;
}
#ifdef __CYGWIN__
/* Convert POSIX path to Win32 path,
remove drive letter, replace backslashes. */
static char *
get_win32_path (const char *path)
{
char winpath[PATH_MAX];
cygwin_conv_to_full_win32_path (path, winpath);
int len = strlen (winpath);
if (len > 2 && winpath[1] == ':')
{
len -= 2;
memmove (winpath, winpath + 2, len + 1);
}
int i;
for (i = 0; i < len; i++)
if (winpath[i] == '\\')
winpath[i] = '/';
return xstrdup (winpath);
}
#endif
char *
grub_get_prefix (const char *dir)
{
char *saved_cwd;
char *abs_dir, *prev_dir;
char *prefix;
struct stat st, prev_st;
/* Save the current directory. */
saved_cwd = xgetcwd ();
if (chdir (dir) < 0)
grub_util_error ("cannot change directory to `%s'", dir);
abs_dir = xgetcwd ();
strip_extra_slashes (abs_dir);
prev_dir = xstrdup (abs_dir);
if (stat (".", &prev_st) < 0)
grub_util_error ("cannot stat `%s'", dir);
if (! S_ISDIR (prev_st.st_mode))
grub_util_error ("`%s' is not a directory", dir);
while (1)
{
if (chdir ("..") < 0)
grub_util_error ("cannot change directory to the parent");
if (stat (".", &st) < 0)
grub_util_error ("cannot stat current directory");
if (! S_ISDIR (st.st_mode))
grub_util_error ("current directory is not a directory???");
if (prev_st.st_dev != st.st_dev || prev_st.st_ino == st.st_ino)
break;
free (prev_dir);
prev_dir = xgetcwd ();
prev_st = st;
}
strip_extra_slashes (prev_dir);
prefix = xmalloc (strlen (abs_dir) - strlen (prev_dir) + 2);
prefix[0] = '/';
strcpy (prefix + 1, abs_dir + strlen (prev_dir));
strip_extra_slashes (prefix);
if (chdir (saved_cwd) < 0)
grub_util_error ("cannot change directory to `%s'", dir);
#ifdef __CYGWIN__
if (st.st_dev != (DEV_CYGDRIVE_MAJOR << 16))
{
/* Reached some mount point not below /cygdrive.
GRUB does not know Cygwin's emulated mounts,
convert to Win32 path. */
grub_util_info ("Cygwin prefix = %s", prefix);
char * wprefix = get_win32_path (prefix);
free (prefix);
prefix = wprefix;
}
#endif
free (saved_cwd);
free (abs_dir);
free (prev_dir);
grub_util_info ("prefix = %s", prefix);
return prefix;
}
#ifdef __MINGW32__
static char *
@ -637,4 +541,3 @@ grub_util_check_char_device (const char *blk_dev)
else
return 0;
}

View file

@ -22,8 +22,8 @@
#include <grub/msdos_partition.h>
#include <grub/types.h>
#include <grub/err.h>
#include <grub/util/misc.h>
#include <grub/util/hostdisk.h>
#include <grub/emu/misc.h>
#include <grub/emu/hostdisk.h>
#include <grub/misc.h>
#include <grub/i18n.h>
#include <grub/list.h>
@ -98,6 +98,10 @@ struct hd_geometry
# include <sys/disk.h>
#endif
#ifdef HAVE_DEVICE_MAPPER
# include <libdevmapper.h>
#endif
#if defined(__NetBSD__)
# include <sys/ioctl.h>
# include <sys/disklabel.h> /* struct disklabel */
@ -312,6 +316,140 @@ grub_util_biosdisk_open (const char *name, grub_disk_t disk)
return GRUB_ERR_NONE;
}
#ifdef HAVE_DEVICE_MAPPER
static int
device_is_mapped (const char *dev)
{
struct stat st;
if (stat (dev, &st) < 0)
return 0;
return dm_is_dm_major (major (st.st_rdev));
}
#endif /* HAVE_DEVICE_MAPPER */
#if defined(__linux__) || defined(__CYGWIN__) || defined(__NetBSD__)
static grub_disk_addr_t
find_partition_start (const char *dev)
{
int fd;
# if !defined(__NetBSD__)
struct hd_geometry hdg;
# else /* defined(__NetBSD__) */
struct disklabel label;
int index;
# endif /* !defined(__NetBSD__) */
# ifdef HAVE_DEVICE_MAPPER
if (device_is_mapped (dev)) {
struct dm_task *task = NULL;
grub_uint64_t start, length;
char *target_type, *params, *space;
grub_disk_addr_t partition_start;
/* If any device-mapper operation fails, we fall back silently to
HDIO_GETGEO. */
task = dm_task_create (DM_DEVICE_TABLE);
if (! task)
{
grub_dprintf ("hostdisk", "dm_task_create failed\n");
goto devmapper_fail;
}
if (! dm_task_set_name (task, dev))
{
grub_dprintf ("hostdisk", "dm_task_set_name failed\n");
goto devmapper_fail;
}
if (! dm_task_run (task))
{
grub_dprintf ("hostdisk", "dm_task_run failed\n");
goto devmapper_fail;
}
dm_get_next_target (task, NULL, &start, &length, &target_type, &params);
if (! target_type)
{
grub_dprintf ("hostdisk", "no dm target\n");
goto devmapper_fail;
}
if (strcmp (target_type, "linear") != 0)
{
grub_dprintf ("hostdisk", "ignoring dm target %s (not linear)\n",
target_type);
goto devmapper_fail;
}
if (! params)
{
grub_dprintf ("hostdisk", "no dm params\n");
goto devmapper_fail;
}
/* The params string for a linear target looks like this:
DEVICE-NAME START-SECTOR
Parse this out. */
space = strchr (params, ' ');
if (! space)
goto devmapper_fail;
errno = 0;
partition_start = strtoull (space + 1, NULL, 10);
if (errno == 0)
{
grub_dprintf ("hostdisk", "dm %s starts at %llu\n",
dev, (unsigned long long) partition_start);
dm_task_destroy (task);
return partition_start;
}
devmapper_fail:
if (task)
dm_task_destroy (task);
}
# endif /* HAVE_DEVICE_MAPPER */
fd = open (dev, O_RDONLY);
if (fd == -1)
{
grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s' while attempting to get disk geometry", dev);
return 0;
}
# if !defined(__NetBSD__)
if (ioctl (fd, HDIO_GETGEO, &hdg))
# else /* defined(__NetBSD__) */
configure_device_driver (fd);
if (ioctl (fd, DIOCGDINFO, &label) == -1)
# endif /* !defined(__NetBSD__) */
{
grub_error (GRUB_ERR_BAD_DEVICE,
"cannot get disk geometry of `%s'", dev);
close (fd);
return 0;
}
close (fd);
# if !defined(__NetBSD__)
return hdg.start;
# else /* defined(__NetBSD__) */
/* Since dev and convert_system_partition_to_system_disk (dev) are
* different, we know that dev is of the form /dev/r[wsc]d[0-9]+[a-z]
* and in particular it cannot be a floppy device. */
index = dev[strlen(dev) - 1] - 'a';
if (index >= label.d_npartitions)
{
grub_error (GRUB_ERR_BAD_DEVICE,
"no disk label entry for `%s'", dev);
return 0;
}
return (grub_disk_addr_t) label.d_partitions[index].p_offset;
# endif /* !defined(__NetBSD__) */
}
#endif /* __linux__ || __CYGWIN__ */
#ifdef __linux__
/* Cache of partition start sectors for each disk. */
struct linux_partition_cache
@ -365,28 +503,26 @@ linux_find_partition (char *dev, unsigned long sector)
for (i = 1; i < 10000; i++)
{
int fd;
struct hd_geometry hdg;
grub_disk_addr_t start;
sprintf (p, format, i);
fd = open (real_dev, O_RDONLY);
if (fd == -1)
return 0;
if (ioctl (fd, HDIO_GETGEO, &hdg))
{
close (fd);
return 0;
}
close (fd);
if (hdg.start == sector)
start = find_partition_start (real_dev);
/* We don't care about errors here. */
grub_errno = GRUB_ERR_NONE;
if (start == sector)
{
struct linux_partition_cache *new_cache_item;
new_cache_item = xmalloc (sizeof *new_cache_item);
new_cache_item->dev = xstrdup (dev);
new_cache_item->start = hdg.start;
new_cache_item->start = start;
new_cache_item->partno = i;
grub_list_push (GRUB_AS_LIST_P (&linux_partition_cache_list),
GRUB_AS_LIST (new_cache_item));
@ -877,7 +1013,7 @@ make_device_name (int drive, int dos_part, int bsd_part)
}
static char *
convert_system_partition_to_system_disk (const char *os_dev)
convert_system_partition_to_system_disk (const char *os_dev, struct stat *st)
{
#if defined(__linux__)
char *path = xmalloc (PATH_MAX);
@ -995,6 +1131,96 @@ convert_system_partition_to_system_disk (const char *os_dev)
p[4] = '\0';
return path;
}
#ifdef HAVE_DEVICE_MAPPER
/* If this is a DM-RAID device. */
if ((strncmp ("mapper/", p, 7) == 0))
{
static struct dm_tree *tree = NULL;
uint32_t maj, min;
struct dm_tree_node *node, *child;
void *handle;
const char *node_uuid, *mapper_name, *child_uuid, *child_name;
if (! tree)
tree = dm_tree_create ();
if (! tree)
{
grub_dprintf ("hostdisk", "dm_tree_create failed\n");
return NULL;
}
maj = major (st->st_rdev);
min = minor (st->st_rdev);
if (! dm_tree_add_dev (tree, maj, min))
{
grub_dprintf ("hostdisk", "dm_tree_add_dev failed\n");
return NULL;
}
node = dm_tree_find_node (tree, maj, min);
if (! node)
{
grub_dprintf ("hostdisk", "dm_tree_find_node failed\n");
return NULL;
}
node_uuid = dm_tree_node_get_uuid (node);
if (! node_uuid)
{
grub_dprintf ("hostdisk", "%s has no DM uuid\n", path);
return NULL;
}
else if (strncmp (node_uuid, "DMRAID-", 7) != 0)
{
grub_dprintf ("hostdisk", "%s is not DM-RAID\n", path);
return NULL;
}
handle = NULL;
mapper_name = NULL;
/* Counter-intuitively, device-mapper refers to the disk-like
device containing a DM-RAID partition device as a "child" of
the partition device. */
child = dm_tree_next_child (&handle, node, 0);
if (! child)
{
grub_dprintf ("hostdisk", "%s has no DM children\n", path);
goto devmapper_out;
}
child_uuid = dm_tree_node_get_uuid (child);
if (! child_uuid)
{
grub_dprintf ("hostdisk", "%s child has no DM uuid\n", path);
goto devmapper_out;
}
else if (strncmp (child_uuid, "DMRAID-", 7) != 0)
{
grub_dprintf ("hostdisk", "%s child is not DM-RAID\n", path);
goto devmapper_out;
}
child_name = dm_tree_node_get_name (child);
if (! child_name)
{
grub_dprintf ("hostdisk", "%s child has no DM name\n", path);
goto devmapper_out;
}
mapper_name = child_name;
devmapper_out:
if (! mapper_name)
{
/* This is a DM-RAID disk, not a partition. */
mapper_name = dm_tree_node_get_name (node);
if (! mapper_name)
{
grub_dprintf ("hostdisk", "%s has no DM name\n", path);
return NULL;
}
}
return xasprintf ("/dev/mapper/%s", mapper_name);
}
#endif /* HAVE_DEVICE_MAPPER */
}
return path;
@ -1091,12 +1317,12 @@ device_is_wholedisk (const char *os_dev)
#endif /* defined(__NetBSD__) */
static int
find_system_device (const char *os_dev)
find_system_device (const char *os_dev, struct stat *st)
{
unsigned int i;
char *os_disk;
os_disk = convert_system_partition_to_system_disk (os_dev);
os_disk = convert_system_partition_to_system_disk (os_dev, st);
if (! os_disk)
return -1;
@ -1130,7 +1356,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
return 0;
}
drive = find_system_device (os_dev);
drive = find_system_device (os_dev, &st);
if (drive < 0)
{
grub_error (GRUB_ERR_UNKNOWN_DEVICE,
@ -1138,8 +1364,8 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
return 0;
}
if (grub_strcmp (os_dev, convert_system_partition_to_system_disk (os_dev))
== 0)
if (grub_strcmp (os_dev,
convert_system_partition_to_system_disk (os_dev, &st)) == 0)
return make_device_name (drive, -1, -1);
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__NetBSD__)
@ -1164,15 +1390,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
{
char *name;
grub_disk_t disk;
int fd;
# if !defined(__NetBSD__)
struct hd_geometry hdg;
typeof (hdg.start) p_offset;
# else /* defined(__NetBSD__) */
struct disklabel label;
int index;
u_int32_t p_offset;
# endif /* !defined(__NetBSD__) */
grub_disk_addr_t start;
int dos_part = -1;
int bsd_part = -1;
auto int find_partition (grub_disk_t dsk,
@ -1187,7 +1405,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
part_start = grub_partition_get_start (partition);
if (p_offset == part_start)
if (start == part_start)
{
if (partition->parent)
{
@ -1218,46 +1436,16 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
index = os_dev[strlen(os_dev) - 1] - 'a';
# endif /* !defined(__NetBSD__) */
fd = open (os_dev, O_RDONLY);
if (fd == -1)
start = find_partition_start (os_dev);
if (grub_errno != GRUB_ERR_NONE)
{
grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s' while attempting to get disk geometry", os_dev);
free (name);
return 0;
}
# if !defined(__NetBSD__)
if (ioctl (fd, HDIO_GETGEO, &hdg))
# else /* defined(__NetBSD__) */
configure_device_driver (fd);
if (ioctl (fd, DIOCGDINFO, &label) == -1)
# endif /* !defined(__NetBSD__) */
{
grub_error (GRUB_ERR_BAD_DEVICE,
"cannot get disk geometry of `%s'", os_dev);
close (fd);
free (name);
return 0;
}
grub_util_info ("%s starts from %lu", os_dev, start);
close (fd);
# if !defined(__NetBSD__)
p_offset = hdg.start;
# else /* defined(__NetBSD__) */
if (index >= label.d_npartitions)
{
grub_error (GRUB_ERR_BAD_DEVICE,
"no disk label entry for `%s'", os_dev);
free (name);
return 0;
}
p_offset = label.d_partitions[index].p_offset;
# endif /* !defined(__NetBSD__) */
grub_util_info ("%s starts from %lu", os_dev, p_offset);
if (p_offset == 0 && device_is_wholedisk (os_dev))
if (start == 0 && device_is_wholedisk (os_dev))
return name;
grub_util_info ("opening the device %s", name);

View file

@ -16,7 +16,10 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
#include <sys/stat.h>
#include <getopt.h>
#include <string.h>
@ -24,16 +27,17 @@
#include <sys/types.h>
#include <unistd.h>
#include <grub/dl.h>
#include <grub/mm.h>
#include <grub/setjmp.h>
#include <grub/fs.h>
#include <grub/util/hostdisk.h>
#include <grub/dl.h>
#include <grub/util/console.h>
#include <grub/util/misc.h>
#include <grub/emu/hostdisk.h>
#include <grub/time.h>
#include <grub/emu/console.h>
#include <grub/emu/misc.h>
#include <grub/kernel.h>
#include <grub/normal.h>
#include <grub/util/getroot.h>
#include <grub/emu/getroot.h>
#include <grub/env.h>
#include <grub/partition.h>
#include <grub/i18n.h>
@ -242,7 +246,7 @@ main (int argc, char *argv[])
if (strcmp (root_dev, "host") == 0)
dir = xstrdup (dir);
else
dir = grub_get_prefix (dir);
dir = grub_make_system_path_relative_to_its_root (dir);
prefix = xmalloc (strlen (root_dev) + 2 + strlen (dir) + 1);
sprintf (prefix, "(%s)%s", root_dev, dir);
free (dir);
@ -261,3 +265,32 @@ main (int argc, char *argv[])
return 0;
}
#ifdef __MINGW32__
void
grub_millisleep (grub_uint32_t ms)
{
Sleep (ms);
}
#else
void
grub_millisleep (grub_uint32_t ms)
{
struct timespec ts;
ts.tv_sec = ms / 1000;
ts.tv_nsec = (ms % 1000) * 1000000;
nanosleep (&ts, NULL);
}
#endif
#if GRUB_NO_MODULES
void
grub_register_exported_symbols (void)
{
}
#endif

309
kern/emu/misc.c Normal file
View file

@ -0,0 +1,309 @@
#include <config.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <grub/mm.h>
#include <grub/err.h>
#include <grub/env.h>
#include <grub/types.h>
#include <grub/misc.h>
#include <grub/i18n.h>
#include <grub/time.h>
#include <grub/emu/misc.h>
int verbosity;
void
grub_util_warn (const char *fmt, ...)
{
va_list ap;
fprintf (stderr, _("%s: warn:"), program_name);
fprintf (stderr, " ");
va_start (ap, fmt);
vfprintf (stderr, fmt, ap);
va_end (ap);
fprintf (stderr, ".\n");
fflush (stderr);
}
void
grub_util_info (const char *fmt, ...)
{
if (verbosity > 0)
{
va_list ap;
fprintf (stderr, _("%s: info:"), program_name);
fprintf (stderr, " ");
va_start (ap, fmt);
vfprintf (stderr, fmt, ap);
va_end (ap);
fprintf (stderr, ".\n");
fflush (stderr);
}
}
void
grub_util_error (const char *fmt, ...)
{
va_list ap;
fprintf (stderr, _("%s: error:"), program_name);
fprintf (stderr, " ");
va_start (ap, fmt);
vfprintf (stderr, fmt, ap);
va_end (ap);
fprintf (stderr, ".\n");
exit (1);
}
void *
xmalloc (grub_size_t size)
{
void *p;
p = malloc (size);
if (! p)
grub_util_error ("out of memory");
return p;
}
void *
xrealloc (void *ptr, grub_size_t size)
{
ptr = realloc (ptr, size);
if (! ptr)
grub_util_error ("out of memory");
return ptr;
}
char *
xstrdup (const char *str)
{
size_t len;
char *newstr;
len = strlen (str);
newstr = (char *) xmalloc (len + 1);
memcpy (newstr, str, len + 1);
return newstr;
}
#ifndef HAVE_VASPRINTF
int
vasprintf (char **buf, const char *fmt, va_list ap)
{
/* Should be large enough. */
*buf = xmalloc (512);
return vsprintf (*buf, fmt, ap);
}
#endif
#ifndef HAVE_ASPRINTF
int
asprintf (char **buf, const char *fmt, ...)
{
int status;
va_list ap;
va_start (ap, fmt);
status = vasprintf (*buf, fmt, ap);
va_end (ap);
return status;
}
#endif
char *
xasprintf (const char *fmt, ...)
{
va_list ap;
char *result;
va_start (ap, fmt);
if (vasprintf (&result, fmt, ap) < 0)
{
if (errno == ENOMEM)
grub_util_error ("out of memory");
return NULL;
}
return result;
}
void
grub_exit (void)
{
exit (1);
}
grub_uint64_t
grub_get_time_ms (void)
{
struct timeval tv;
gettimeofday (&tv, 0);
return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
}
grub_uint32_t
grub_get_rtc (void)
{
struct timeval tv;
gettimeofday (&tv, 0);
return (tv.tv_sec * GRUB_TICKS_PER_SECOND
+ (((tv.tv_sec % GRUB_TICKS_PER_SECOND) * 1000000 + tv.tv_usec)
* GRUB_TICKS_PER_SECOND / 1000000));
}
char *
canonicalize_file_name (const char *path)
{
char *ret;
#ifdef PATH_MAX
ret = xmalloc (PATH_MAX);
(void) realpath (path, ret);
#else
ret = realpath (path, NULL);
#endif
return ret;
}
#ifdef __CYGWIN__
/* Convert POSIX path to Win32 path,
remove drive letter, replace backslashes. */
static char *
get_win32_path (const char *path)
{
char winpath[PATH_MAX];
if (cygwin_conv_path (CCP_POSIX_TO_WIN_A, path, winpath, sizeof(winpath)))
grub_util_error ("cygwin_conv_path() failed");
int len = strlen (winpath);
int offs = (len > 2 && winpath[1] == ':' ? 2 : 0);
int i;
for (i = offs; i < len; i++)
if (winpath[i] == '\\')
winpath[i] = '/';
return xstrdup (winpath + offs);
}
#endif
/* This function never prints trailing slashes (so that its output
can be appended a slash unconditionally). */
char *
grub_make_system_path_relative_to_its_root (const char *path)
{
struct stat st;
char *p, *buf, *buf2, *buf3;
uintptr_t offset = 0;
dev_t num;
size_t len;
/* canonicalize. */
p = canonicalize_file_name (path);
if (p == NULL)
grub_util_error ("failed to get canonical path of %s", path);
len = strlen (p) + 1;
buf = xstrdup (p);
free (p);
if (stat (buf, &st) < 0)
grub_util_error ("cannot stat %s: %s", buf, strerror (errno));
buf2 = xstrdup (buf);
num = st.st_dev;
/* This loop sets offset to the number of chars of the root
directory we're inspecting. */
while (1)
{
p = strrchr (buf, '/');
if (p == NULL)
/* This should never happen. */
grub_util_error ("FIXME: no / in buf. (make_system_path_relative_to_its_root)");
if (p != buf)
*p = 0;
else
*++p = 0;
if (stat (buf, &st) < 0)
grub_util_error ("cannot stat %s: %s", buf, strerror (errno));
/* buf is another filesystem; we found it. */
if (st.st_dev != num)
{
/* offset == 0 means path given is the mount point.
This works around special-casing of "/" in Un*x. This function never
prints trailing slashes (so that its output can be appended a slash
unconditionally). Each slash in is considered a preceding slash, and
therefore the root directory is an empty string. */
if (offset == 0)
{
free (buf);
free (buf2);
return xstrdup ("");
}
else
break;
}
offset = p - buf;
/* offset == 1 means root directory. */
if (offset == 1)
{
/* Include leading slash. */
offset = 0;
break;
}
}
free (buf);
buf3 = xstrdup (buf2 + offset);
free (buf2);
#ifdef __CYGWIN__
if (st.st_dev != (DEV_CYGDRIVE_MAJOR << 16))
{
/* Reached some mount point not below /cygdrive.
GRUB does not know Cygwin's emulated mounts,
convert to Win32 path. */
grub_util_info ("Cygwin path = %s\n", buf3);
char * temp = get_win32_path (buf3);
free (buf3);
buf3 = temp;
}
#endif
/* Remove trailing slashes, return empty string if root directory. */
len = strlen (buf3);
while (len > 0 && buf3[len - 1] == '/')
{
buf3[len - 1] = '\0';
len--;
}
return buf3;
}

View file

@ -22,7 +22,6 @@
#include <grub/machine/init.h>
#include <grub/machine/memory.h>
#include <grub/machine/console.h>
#include <grub/machine/kernel.h>
#include <grub/types.h>
#include <grub/err.h>
#include <grub/dl.h>
@ -33,8 +32,10 @@
#include <grub/time.h>
#include <grub/symbol.h>
#include <grub/cpu/io.h>
#include <grub/cpu/kernel.h>
#include <grub/cpu/tsc.h>
#ifdef GRUB_MACHINE_QEMU
#include <grub/machine/kernel.h>
#endif
#define GRUB_FLOPPY_REG_DIGITAL_OUTPUT 0x3f2
@ -117,7 +118,9 @@ grub_machine_init (void)
return 0;
}
#if defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
grub_machine_mmap_init ();
#endif
grub_machine_mmap_iterate (heap_init);
grub_tsc_init ();
@ -144,6 +147,6 @@ grub_arch_modules_addr (void)
#ifdef GRUB_MACHINE_QEMU
return grub_core_entry_addr + grub_kernel_image_size;
#else
return ALIGN_UP((grub_addr_t) _end, GRUB_MOD_ALIGN);
return ALIGN_UP((grub_addr_t) _end, GRUB_KERNEL_MACHINE_MOD_ALIGN);
#endif
}

View file

@ -57,13 +57,23 @@ signature_found:
(long) table_header->size);
for (; table_item->size;
table_item = (grub_linuxbios_table_item_t) ((long) table_item + (long) table_item->size))
if (hook (table_item))
return 1;
{
if (table_item->tag == GRUB_LINUXBIOS_MEMBER_LINK
&& check_signature ((grub_linuxbios_table_header_t) (grub_addr_t)
*(grub_uint64_t *) (table_item + 1)))
{
table_header = (grub_linuxbios_table_header_t) (grub_addr_t)
*(grub_uint64_t *) (table_item + 1);
goto signature_found;
}
if (hook (table_item))
return 1;
}
return 0;
}
void
grub_err_t
grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
{
mem_region_t mem_region;

Some files were not shown because too many files have changed in this diff Show more