Commit graph

86 commits

Author SHA1 Message Date
robertmh
92f33540d8 2009-03-30 Robert Millan <rmh@aybabtu.com>
* loader/i386/linux.c (grub_cmd_linux): Check for zImage before
        checking for abi version.  Improve error messages on BIOS to notify
        user about `linux16' command.
2009-03-30 22:22:31 +00:00
robertmh
9c323f0961 2009-03-29 Robert Millan <rmh@aybabtu.com>
* loader/i386/linux.c (grub_cmd_linux): Parse "vga=" parameter and
        set `vid_mode' accordingly.
        (grub_linux_boot): Process `vid_mode' and set video mode.
2009-03-29 19:52:35 +00:00
robertmh
a9368fd30c 2009-03-28 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (pkglib_MODULES): Add `linux16.mod'.
        (linux16_mod_SOURCES, linux16_mod_CFLAGS, linux16_mod_LDFLAGS): New
        variables.  Use 16-bit loader.
        (linux_mod_SOURCES, linux_mod_CFLAGS, linux_mod_LDFLAGS): Use 32-bit
        loader.
        * kern/i386/loader.S (grub_linux_boot): Rename to ...
        (grub_linux16_boot): ... this.  Update all users.
        * loader/i386/linux.c (grub_linux32_boot): Rename to ...
        (grub_linux_boot): ... this.  Update all users.

        * loader/i386/pc/linux.c (GRUB_MOD_INIT(linux)): Rename to ...
        (GRUB_MOD_INIT(linux16)): ... this.  Rename `linux' and `initrd'
        commands to `linux16' and `initrd16'.
        (GRUB_MOD_FINI(linux)): Rename to ...
        (GRUB_MOD_FINI(linux16)): ... this.
2009-03-28 12:53:16 +00:00
robertmh
c04d6e0548 2009-03-22 Vladimir Serbinenko <phcoder@gmail.com>
Move multiboot helper out of kernel

        * conf/i386-pc.rmk (multiboot_mod_SOURCES): Add
        `loader/i386/multiboot_helper.S'.
        * conf/i386-coreboot.rmk: Likewise
        * conf/i386-ieee1275.rmk: Likewise

        * kern/i386/loader.S: Move multiboot helpers from here...
        * loader/i386/multiboot_helper.S: ...moved here
        * include/grub/i386/loader.h: Move declarations of multiboot
        helpers from here...
        * include/grub/i386/multiboot.h: ...moved here
        * loader/i386/multiboot.c: Added include of grub/cpu/multiboot.h
2009-03-22 12:28:00 +00:00
robertmh
2274cc8fc9 2009-03-21 Vladimir Serbinenko <phcoder@gmail.com>
Bugfixes in multiboot for bugs uncovered by solaris kernel.

        * loader/i386/multiboot_elfxx.c (grub_multiboot_load_elf): Corrected
        limit detection.
        Use vaddr of correct segment for entry_point.
2009-03-21 23:02:12 +00:00
bean
b1b797cb1b 2009-03-21 Bean <bean123ch@gmail.com>
* commands/blocklist.c: Add include file <grub/command.h>, remove
	<grub/normal.h> and <grub/arg.h>.
	(grub_cmd_blocklist): Use the new command interface.
	(GRUB_MOD_INIT): Likewise.
	(GRUB_MOD_FINI): Likewise.
	* commands/boot.c: Likewise.
	* commands/cat.c: Likewise.
	* commands/cmp.c: Likewise.
	* commands/configfile.c: Likewise.
	* commands/crc.c: Likewise.
	* commands/echo.c: Likewise.
	* commands/halt.c: Likewise.
	* commands/handler.c: Likewise.
	* commands/hdparm.c: Likewise.
	* commands/help.c: Likewise.
	* commands/hexdump.c: Likewise.
	* commands/loadenv.c: Likewise.
	* commands/ls.c: Likewise.
	* commands/lsmmap.c: Likewise.
	* commands/lspci.c: Likewise.
	* commands/loadenv.c: Likewise.
	* commands/read.c: Likewise.
	* commands/reboot.c: Likewise.
	* commands/search.c: Likewise.
	* commands/sleep.c: Likewise.
	* commands/test.c: Likewise.
	* commands/usbtest.c: Likewise.
	* commands/videotest.c: Likewise.
	* commands/i386/cpuid.c: Likewise.
	* commands/i386/pc/halt.c: Likewise.
	* commands/i386/pc/play.c: Likewise.
	* commands/i386/pc/pxecmd.c: Likewise.
	* commands/i386/pc/vbeinfo.c: Likewise.
	* commands/i386/pc/vbetest.c: Likewise.
	* commands/ieee1275/suspend.c: Likewise.
	* disk/loopback.c: Likewise.
	* font/font_cmd.c: Likewise.
	* hello/hello.c: Likewise.
	* loader/efi/appleloader.c: Likewise.
	* loader/efi/chainloader.c: Likewise.
	* loader/i386/bsd.c: Likewise.
	* loader/i386/efi/linux.c: Likewise.
	* loader/i386/ieee1275/linux.c: Likewise.
	* loader/i386/linux.c: Likewise.
	* loader/i386/pc/chainloader.c: Likewise.
	* loader/i386/pc/linux.c: Likewise.
	* loader/powerpc/ieee1275/linux.c: Likewise.
	* loader/multiboot_loader.c: Likewise.
	* term/gfxterm.c: Likewise.
	* term/i386/pc/serial.c: Likewise.
	* term/terminfo.c: Likewise.

	* term/i386/pc/vesafb.c: Removed <grub/arg.h>.
	* term/i386/pc/vga.c: Likewise.
	* video/readers/jpeg.c: Likewise.
	* video/readers/png.c: Likewise.
	* video/readers/tga.c: Likewise.

	* util/grub-fstest (cmd_loopback): Removed.
	(cmd_blocklist): Likewise.
	(cmd_ls): Likewise.
	(grub_register_command): Likewise.
	(grub_unregister_command): Likewise.
	(execute_command): Use grub_command_find to locate command and execute
	it.

	* include/grub/efi/chainloader.h: Removed.
	* loader/efi/chainloader_normal.c: Likewise.
	* loader/i386/bsd_normal.c: Likewise.
	* loader/i386/pc/chainloader_normal.c: Likewise.
	* loader/i386/pc/multiboot_normal.c: Likewise.
	* loader/linux_normal.c: Likewise.
	* loader/multiboot_loader_normal.c: Likewise.
	* loader/powerpc/ieee1275/linux_normal.c: Likewise.

	* gencmdlist.sh: Scan new registration command grub_register_extcmd
	and grub_register_command_p1.

	* conf/common.rmk (grub_fstest_SOURCES): Add kern/list.c,
	kern/command.c, lib/arg.c and commands/extcmd.c.
	(pkglib_MODULES): Remove boot.mod, and minicmd.mod and extcmd.mod.
	(minicmd_mod_SOURCES): New variable.
	(minicmd_mod_CFLAGS): Likewise.
	(minicmd_mod_LDFLAGS): Likewise.
	(extcmd_mod_SOURCES): Likewise.
	(extcmd_mod_CFLAGS): Likewise.
	(extcmd_mod_LDFLAGS): Likewise.
	(boot_mod_SOURCES): Removed.
	(boot_mod_CFLAGS): Likewise.
	(boot_mod_LDFLAGS): Likewise.

	* conf/i386-pc.rmk (kernel_img_SOURCES): Add kern/command.c and
	kern/corecmd.c.
	(kernel_img_HEADERS): Add command.h.
	(grub_emu_SOURCES): Remove commands/boot.c and normal/arg.c, add
	commands/minicmd.c, kern/command.c, kern/corecmd.c, commands/extcmd.c
	and lib/arg.c.
	(pkglib_MODULES): Change _linux.mod, _chain.mod, _bsd.mod and
	_multiboot.mod as linux.mod, chain.mod, bsd.mod and multiboot.mod,
	remove the corresponding normal mode command.
	(normal_mod_SOURCES): Remove normal/arg.c.
	* conf/i386-coreboot.rmk: Likewise.
	* conf/i386-efi.rmk: Likewise.
	* conf/i386-ieee1275.rmk: Likewise.
	* conf/powerpc-ieee1275.rmk: Likewise.
	* conf/x86_64-efi.rmk: Likewise.

	* include/grub/arg.h: Move from here ...
	* include/grub/lib/arg.h: ... to here.

	* normal/arg.c: Move from here ...
	* lib/arg.c: ... to here.

	* commands/extcmd.c: New file.
	* commands/minicmd.c: Likewise.
	* include/grub/command.h: Likewise.
	* include/grub/extcmd.h: Likewise.
	* kern/command.c: Likewise.
	* kern/corecmd.c: Likewise.

	* kern/list.c (grub_list_iterate): Return int instead of void.
	(grub_list_insert): New function.
	(grub_prio_list_insert): Likewise.

	* kern/rescue.c (grub_rescue_command): Removed.
	(grub_rescue_command_list): Likewise.
	(grub_rescue_register_command): Likewise.
	(grub_rescue_unregister_command): Likewise.
	(grub_rescue_cmd_boot): Move to minicmd.c
	(grub_rescue_cmd_help): Likewise.
	(grub_rescue_cmd_info): Likewise.
	(grub_rescue_cmd_boot): Likewise.
	(grub_rescue_cmd_testload): Likewise.
	(grub_rescue_cmd_dump): Likewise.
	(grub_rescue_cmd_rmmod): Likewise.
	(grub_rescue_cmd_lsmod): Likewise.
	(grub_rescue_cmd_exit): Likewise.
	(grub_rescue_print_devices): Moved to corecmd.c.
	(grub_rescue_print_files): Likewise.
	(grub_rescue_cmd_ls): Likewise.
	(grub_rescue_cmd_insmod): Likewise.
	(grub_rescue_cmd_set): Likewise.
	(grub_rescue_cmd_unset): Likewise.
	(attemp_normal_mode): Use grub_command_find to get normal module.
	(grub_enter_rescue_mode): Use grub_register_core_commands to register
	commands, remove grub_rescue_regiter_command calls.

	* normal/command.c (grub_regiser_command): Removed.
	(grub_unregister_command): Likewise.
	(grub_command_find): Likewise.
	(grub_iterate_commands): Likewise.
	(rescue_command): Likewise.
	(export_command): Moved to corecmd.c.
	(set_command): Removed.
	(unset_command): Likewise.
	(insmod_command): Likewise.
	(rmmod_command): Likewise.
	(lsmod_command): Likewise.
	(grub_command_init): Likewise.

	* normal/completion.c (iterate_command): Use cmd->prio to check for
	active command.
	(complete_arguments): Use grub_extcmd_t structure to find options.
	(grub_normal_do_completion): Change function grub_iterate_commands to
	grub_command_iterate.

	* normal/execute.c (grub_script_execute_cmd): No need to parse
	argument here.

	* normal/main.c (grub_dyncmd_dispatcher): New function.
	(read_command_list): Register unload commands as dyncmd.
	(grub_cmd_normal): Use new command interface, register rescue,
	unregister normal at entry, register normal, unregister rescue at exit.

	* include/grub/list.h (grub_list_test_t): New type.
	(grub_list_iterate): Return int instead of void.
	(grub_list_insert): New function.
	(GRUB_AS_NAMED_LIST_P): New macro.
	(GRUB_AS_PRIO_LIST): Likewise.
	(GRUB_AS_PRIO_LIST_P): Likewise.
	(GRUB_PRIO_LIST_PRIO_MASK): New constant.
	(GRUB_PRIO_LIST_FLAG_ACTIVE): Likewise.
	(grub_prio_list): New structure.
	(grub_prio_list_insert): New function.
	(grub_prio_list_remove): New inline function.

	* include/grub/normal.h: Remove <grub/arg.h>, add <grub/command.h>.
	(GRUB_COMMAND_FLAG_CMDLINE): Moved to command.h.
	(GRUB_COMMAND_FLAG_MENU): Likewise.
	(GRUB_COMMAND_FLAG_BOTH): Likewise.
	(GRUB_COMMAND_FLAG_TITLE): Likewise.
	(GRUB_COMMAND_FLAG_NO_ECHO): Likewise.
	(GRUB_COMMAND_FLAG_NO_ARG_PARSE): Removed.
	(GRUB_COMMAND_FLAG_NOT_LOADED): Likewise.
	(grub_command): Likewise.
	(grub_register_command): Likewise.
	(grub_command_find): Likewise.
	(grub_iterate_commands): Likewise.
	(grub_command_init): Likewise.
	(grub_arg_parse): Likewise.
	(grub_arg_show_help): Likewise.

	* include/grub/rescue.h (grub_rescue_register_command): Removed.
	(grub_rescue_unregister_command): Likewise.

	* include/grub/i386/bsd.h: Remove grub_rescue_cmd_freebsd,
	grub_rescue_cmd_openbsd, grub_rescue_cmd_netbsd,
	grub_rescue_cmd_freebsd_loadenv and grub_rescue_cmd_freebsd_module.

	* include/grub/i386/efi/loader.h: Remove grub_rescue_cmd_linux and
	grub_rescue_cmd_initrd.
	* include/grub/i386/loader.h: Likewise.
	* include/grub/x86_64/loader.h: Likewise.

	* include/grub/i386/pc/chainloader.h: Remove grub_chainloader_cmd.
2009-03-21 08:39:59 +00:00
robertmh
14aad8072c 2009-03-18 Robert Millan <rmh@aybabtu.com>
* loader/i386/linux.c: Include `<grub/video.h>' and
        `<grub/i386/pc/vbe.h>'..
        (grub_linux_setup_video): New function.  Loosely based on the EFI one.
        (grub_linux32_boot): Attempt to configure video settings with
        grub_linux_setup_video().
        (grub_rescue_cmd_linux): Set noreturn=0 in grub_loader_set, in order
        to avoid grub_console_fini() which would step out of graphical mode
        unconditionally.
2009-03-18 10:21:28 +00:00
robertmh
6394042e02 2009-03-11 Robert Millan <rmh@aybabtu.com>
* loader/i386/multiboot_elfxx.c
        (CONCAT(grub_multiboot_load_elf, XX)): Do not reject ET_DYN files.
2009-03-11 21:27:01 +00:00
robertmh
1ca7fc96f7 2009-03-11 Robert Millan <rmh@aybabtu.com>
* loader/i386/multiboot.c (code_size): New variable.
        (grub_multiboot): Define offsets by adding to `code_size' rather
        than substracting from `grub_multiboot_payload_size'.  Provide
        4-byte alignment to MBI and others by increasing
        `boot_loader_name_length' appropiately.

        * loader/i386/multiboot_elfxx.c
        (CONCAT(grub_multiboot_load_elf, XX)): Initialize `code_size'.
2009-03-10 23:47:51 +00:00
robertmh
aa9f3bffbd 2009-03-08 Robert Millan <rmh@aybabtu.com>
Make loader/i386/linux.c usable on i386-pc again.

        * kern/i386/pc/init.c (grub_machine_init): Disable addition of low
        memory to heap.
        * loader/i386/linux.c [GRUB_MACHINE_PCBIOS] (allocate_pages): Remove
        `#error' stanza.
2009-03-08 12:46:27 +00:00
bean
d8b3b60eea 2009-03-07 Bean <bean123ch@gmail.com>
* loader/i386/efi/linux.c (grub_rescue_cmd_initrd): Fix a bug in initrd
	allocation.
2009-03-07 10:50:43 +00:00
robertmh
f501677cb2 2009-03-03 Robert Millan <rmh@aybabtu.com>
Move more components to the relocation area, and fix mbi pointer
        handling to use the destination rather than the origin (thanks to
        Vladimir Serbinenko for spotting).

        * loader/i386/multiboot.c (mbi_dest): New variable.
        (grub_multiboot_boot): Use `mbi_dest' instead of `mbi'.
        (grub_multiboot): Put cmdline, boot_loader_name and mbi in the
        relocation area.
2009-03-03 19:00:41 +00:00
bean
9902d04725 2009-03-01 Bean <bean123ch@gmail.com>
* include/grub/efi/api.h (GRUB_EFI_MPS_TABALE_GUID): New constant.
	(GRUB_EFI_ACPI_TABLE_GUID): Likewise.
	(GRUB_EFI_ACPI_20_TABLE_GUID): Likewise.
	(GRUB_EFI_SMBIOS_TABLE_GUID): Likewise.

	* loader/i386/efi/linux.c (acpi_guid): New variable.
	(acpi_guid): Likewise.
	(EBDA_SEG_ADDR): New constant.
	(LOW_MEM_ADDR): Likewise.
	(FAKE_EBDA_SEG): Likewise.
	(fake_bios_data): New function.
	(grub_linux_boot): Call fake_bios_data.
2009-03-01 17:57:57 +00:00
robertmh
8a31787ff5 2009-02-27 Robert Millan <rmh@aybabtu.com>
Factorize elf32 / elf64 code in Multiboot loader.  This will
        prevent it from getting out of sync again.

        * loader/i386/multiboot.c (grub_multiboot_is_elf32,
        grub_multiboot_load_elf32, grub_multiboot_is_elf64,
        grub_multiboot_load_elf64): Move from here ...
        * loader/i386/multiboot_elfxx.c (grub_multiboot_is_elf,
        grub_multiboot_load_elf): ... to here (new file).
2009-02-27 23:04:46 +00:00
robertmh
4b6bf4f97c 2009-02-27 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c: Move from here ...
        * loader/i386/multiboot.c: ... to here.  Update all users.
2009-02-27 21:19:00 +00:00
bean
6e09b8b72e 2009-02-24 Bean <bean123ch@gmail.com>
* configure.ac: Check for -mcmodel=large in x86_64 target.

	* include/grub/efi/api.h (efi_call_10): New macro.
	(efi_wrap_10): New function.

	* include/grub/efi/pe32.h (GRUB_PE32_REL_BASE_HIGH): New macro.
	(GRUB_PE32_REL_BASED_HIGH): Likewise.
	(GRUB_PE32_REL_BASED_LOW): Likewise.
	(GRUB_PE32_REL_BASED_HIGHLOW): Likewise.
	(GRUB_PE32_REL_BASED_HIGHADJ): Likewise.
	(GRUB_PE32_REL_BASED_MIPS_JMPADDR): Likewise.
	(GRUB_PE32_REL_BASED_SECTION): Likewise.
	(GRUB_PE32_REL_BASED_REL): Likewise.
	(GRUB_PE32_REL_BASED_IA64_IMM64): Likewise.
	(GRUB_PE32_REL_BASED_DIR64): Likewise.
	(GRUB_PE32_REL_BASED_HIGH3ADJ): Likewise.

	* kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Fixed relocation
	issue.

	* kern/x86_64/efi/callwrap.S (efi_wrap_6): Bug fix.
	(efi_wrap_10): New function.

	* kern/x86_64/efi/startup.S (codestart): Use relative addressing.

	* loader/efi/appleloader.c (devpath_5): Add support for late 2008
	MB/MBP model (NV chipset).
	(devdata_devs): Add devpath_5 to the list.

	* load/i386/efi/linux.c (video_base): Remove variable.
	(RGB_MASK): New macro.
	(RGB_MAGIC): Likewise.
	(LINE_MIN): Likewise.
	(LINE_MAX): Likewise.
	(FBTEST_STEP): Likewise.
	(FBTEST_COUNT): Likewise.
	(fb_list): New variable.
	(grub_find_video_card): Remove function.
	(find_framebuf): New function.
	(grub_linux_setup_video): Use find_framebuf to get frame buffer and
	line length.

	* util/i386/efi/grub-mkimage.c (grub_reloc_section): Fix relocation
	problem for x86_64.
2009-02-24 13:19:46 +00:00
robertmh
a455f472aa 2009-02-22 Robert Millan <rmh@aybabtu.com>
* include/multiboot.h (MULTIBOOT_INFO_ALIGN): New macro.
        * loader/i386/pc/multiboot.c (grub_multiboot): Include the MBI
        in our relocation, instead of using it directly from heap.  Also
        use `MULTIBOOT_INFO_ALIGN' to ensure it is aligned.
2009-02-22 00:44:22 +00:00
robertmh
f36cc10867 2009-01-10 Robert Millan <rmh@aybabtu.com>
Update a few copyright years which we forgot to do in 2008 (only for
            files whose changes made in 2008 were copyright-significant)

            * Makefile.in: Add 2008 to Copyright line.
            * disk/ieee1275/ofdisk.c: Likewise.
            * disk/efi/efidisk.c: Likewise.
            * kern/dl.c: Likewise.
            * kern/sparc64/ieee1275/init.c: Likewise.
            * kern/mm.c: Likewise.
            * kern/efi/mm.c: Likewise.
            * boot/i386/pc/boot.S: Likewise.
            * genfslist.sh: Likewise.
            * fs/iso9660.c: Likewise.
            * fs/hfs.c: Likewise.
            * fs/jfs.c: Likewise.
            * fs/minix.c: Likewise.
            * fs/ufs.c: Likewise.
            * gensymlist.sh.in: Likewise.
            * genkernsyms.sh.in: Likewise.
            * include/grub/misc.h: Likewise.
            * include/grub/types.h: Likewise.
            * include/grub/symbol.h: Likewise.
            * include/grub/elf.h: Likewise.
            * include/grub/kernel.h: Likewise.
            * include/grub/disk.h: Likewise.
            * include/grub/dl.h: Likewise.
            * include/grub/i386/linux.h: Likewise.
            * include/grub/i386/pc/biosdisk.h: Likewise.
            * include/grub/efi/api.h: Likewise.
            * include/grub/efi/pe32.h: Likewise.
            * include/grub/util/misc.h: Likewise.
            * normal/execute.c: Likewise.
            * normal/arg.c: Likewise.
            * normal/completion.c: Likewise.
            * normal/lexer.c: Likewise.
            * normal/parser.y: Likewise.
            * normal/misc.c: Likewise.
            * commands/i386/pc/vbeinfo.c: Likewise.
            * commands/hexdump.c: Likewise.
            * commands/terminal.c: Likewise.
            * commands/ls.c: Likewise.
            * commands/help.c: Likewise.
            * partmap/pc.c: Likewise.
            * loader/efi/chainloader.c: Likewise.
            * loader/multiboot_loader.c: Likewise.
            * loader/i386/pc/multiboot2.c: Likewise.
            * term/efi/console.c: Likewise.
            * term/i386/pc/serial.c: Likewise.
            * util/lvm.c: Likewise.
            * util/console.c: Likewise.
            * util/i386/efi/grub-mkimage.c: Likewise.
            * util/raid.c: Likewise.
2009-01-10 13:07:44 +00:00
robertmh
40f9faa4de Move comment text to `#error' stanza. 2008-11-20 20:25:30 +00:00
robertmh
e94045a110 * loader/i386/linux.c (allocate_pages): Fix a warning. 2008-11-20 20:22:04 +00:00
robertmh
9290711060 * loader/i386/linux.c (grub_rescue_cmd_initrd): Implement a few needed
constraints to initrd allocation (based on code from
        loader/i386/pc/linux.c).  Without them, initrd was allocated too high
        for Linux to find it.
2008-11-19 12:11:44 +00:00
robertmh
ebaaf49b02 2008-11-19 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/linux.c (grub_rescue_cmd_initrd): Fix a typo.
2008-11-19 12:05:20 +00:00
robertmh
2f2a344257 Add #error instance with comment to explain why this
loader isn't currently usable on PC/BIOS.
2008-11-14 20:18:07 +00:00
robertmh
10fc3eb9a7 2008-11-14 Robert Millan <rmh@aybabtu.com>
* include/grub/i386/coreboot/memory.h (GRUB_MEMORY_MACHINE_LOWER_SIZE):
        Redefine to match with GRUB_MEMORY_MACHINE_UPPER_START (0x100000).  We
        don't want to mess with lower memory, because it is used in the Linux
        loader.

        * loader/i386/linux.c (allocate_pages): Allocate `real_mode_mem' in
        an appropiate place in lower memory, between 0x10000 and 0x90000,
        like loader/i386/efi/linux.c does.  Linux often panics if real_mode_mem
        is in our heap (probably as a result of it being corrupted during
        decompression).
2008-11-14 19:04:26 +00:00
bean
556f377582 2008-11-03 Bean <bean123ch@gmail.com>
* kern/elf.c (grub_elf32_load): Revert to previous code.
	(grub_elf64_load): Likewise.

	* loader/i386/bsd.c (grub_bsd_elf32_hook): Change return address.
2008-11-03 13:08:21 +00:00
robertmh
89d5ffcfd1 2008-09-08 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Skip
        segments when their filesz is zero (grub_file_read() interprets
        zero-size as "read untill EOF", which results in memory corruption).
        Use `lowest_segment' rather than 0 for calculating the current
        segment load address.
2008-09-08 19:10:16 +00:00
robertmh
783d0f484f 2008-09-07 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (mmap_addr, mmap_length): Remove
        variables.
        (grub_multiboot): Move `mbi' allocation upwards, so that mmap address
        and length can be stored directly in the `mbi->mmap_addr' and
        `mbi->mmap_length' struct fields.
2008-09-07 17:13:00 +00:00
robertmh
93d5cbf809 2008-08-31 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (grub_get_multiboot_mmap_len): Fix
        declaration.
        (grub_multiboot): Fix a few warnings.
2008-08-31 20:43:03 +00:00
robertmh
21751d508a 2008-08-31 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c: Update comment not to say that
        boot_device support is unimplemented.
2008-08-31 19:25:41 +00:00
robertmh
e27a75c58f 2008-08-31 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c: Update comment not to say that a.out
        or memory map support are unimplemented.
2008-08-31 19:12:02 +00:00
robertmh
c9baafe713 2008-08-21 Robert Millan <rmh@aybabtu.com>
* loader/i386/linux.c: New file.  Implements generic 32-bit Linux
        loader.
        * conf/i386-coreboot.rmk (_linux_mod_SOURCES): Replace
        `loader/i386/pc/linux.c' with `loader/i386/linux.c'.
2008-08-21 13:18:07 +00:00
robertmh
dd6bd6abb9 2008-08-18 Robert Millan <rmh@aybabtu.com>
Unify (identical) linux_normal.c files.
        * loader/i386/efi/linux_normal.c: Move from here ...
        * loader/linux_normal.c: ... to here.  Update all users.
        * loader/i386/pc/linux_normal.c: Delete.  Update all users.
        * loader/i386/ieee1275/linux_normal.c: Likewise.
2008-08-18 13:46:31 +00:00
robertmh
7f42f83e87 2008-08-18 Robert Millan <rmh@aybabtu.com>
* include/grub/i386/linux.h (LINUX_LOADER_ID_LILO)
        (LINUX_LOADER_ID_LOADLIN, LINUX_LOADER_ID_BOOTSECT)
        (LINUX_LOADER_ID_SYSLINUX, LINUX_LOADER_ID_ETHERBOOT)
        (LINUX_LOADER_ID_ELILO, LINUX_LOADER_ID_GRUB, LINUX_LOADER_ID_UBOOT)
        (LINUX_LOADER_ID_XEN, LINUX_LOADER_ID_GUJIN, LINUX_LOADER_ID_QEMU):
        New macros.
        (GRUB_LINUX_CL_OFFSET, GRUB_LINUX_CL_END_OFFSET): Move from here ...
        * loader/i386/pc/linux.c (GRUB_LINUX_CL_OFFSET)
        (GRUB_LINUX_CL_END_OFFSET): ... to here.
        * loader/i386/efi/linux.c (GRUB_EFI_CL_OFFSET): Rename to ...
        (GRUB_LINUX_CL_OFFSET): ... this.  Update all users.
        (GRUB_EFI_CL_END_OFFSET): Rename to ...
        (GRUB_LINUX_CL_END_OFFSET): ... this.  Update all users.
        (grub_rescue_cmd_linux): Macroify `type_of_loader' initialization.
        Initialize `params->video_cursor_x' and `params->video_cursor_y'
        portably using grub_getxy().
        Replace `-EFI' with `-bzImage' in boot message.
2008-08-18 13:01:01 +00:00
robertmh
deceb3ecd3 2008-08-17 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `kern/i386/pc/mmap.c'.

        * include/grub/i386/pc/init.h (GRUB_MACHINE_MEMORY_AVAILABLE)
        (GRUB_MACHINE_MEMORY_RESERVED): New macros.
        (grub_machine_mmap_iterate): New function declaration.
        * include/grub/multiboot.h (struct grub_multiboot_mmap_entry): New
        structure.
        (GRUB_MMAP_MEMORY_AVAILABLE, GRUB_MMAP_MEMORY_RESERVED): New
        macros.

        * kern/i386/pc/init.c (grub_machine_init): Replace hardcoded region
        type check value with `GRUB_MACHINE_MEMORY_AVAILABLE'.
        Move e820 parsing from here ...
        * kern/i386/pc/mmap.c: New file.
        (grub_machine_mmap_iterate): ... to here.

        * include/grub/i386/coreboot/memory.h: Remove `<grub/err.h>'.
        (GRUB_LINUXBIOS_MEMORY_AVAILABLE): Rename (for consistency) to ...
        (GRUB_MACHINE_MEMORY_AVAILABLE): ... this.  Update all users.
        (grub_available_iterate): Redeclare to return `void', and redeclare
        its hook to use grub_uint64_t as addr and size parameters, and rename
        to ...
        (grub_machine_mmap_iterate): ... this.  Update all users.

        * kern/i386/coreboot/mmap.c (grub_mmap_iterate): Simplify parser loop
        to make it more readable.  Rename to ...
        (grub_machine_mmap_iterate): ... this.

        * loader/i386/pc/multiboot.c (mmap_addr, mmap_length): New variables.
        (grub_get_multiboot_mmap_len, grub_fill_multiboot_mmap): New functions.
        (grub_multiboot): Allocate an extra region after the payload, and fill
        it with a Multiboot memory map.  Adjust a.out loader to calculate size
        with the extra space.
        (grub_multiboot_load_elf32): Adjust elf32 loader to calculate size
        with the extra space.
2008-08-17 16:32:18 +00:00
robertmh
371458b576 2008-08-12 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Move part
        of the relocation code from here ...
        (grub_multiboot): ... to here.
        (forward_relocator, backward_relocator): Move from here ...
        * kern/i386/loader.S (grub_multiboot_forward_relocator)
        (grub_multiboot_backward_relocator): ... to here.
        (grub_multiboot_real_boot): Use %edx for entry offset.  Put Multiboot
        magic in %eax.  Use %ebp for jumping (so %edx is not trashed).
        * include/grub/i386/loader.h (grub_multiboot_forward_relocator)
        (grub_multiboot_forward_relocator_end)
        (grub_multiboot_backward_relocator)
        (grub_multiboot_backward_relocator_end): New variables.
2008-08-12 15:40:26 +00:00
robertmh
a9053f8f5d 2008-08-04 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Fix misc
        warnings introduced in my last commit.
2008-08-04 09:30:36 +00:00
robertmh
93808428ce 2008-08-02 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Add a pair
        of informational grub_dprintf() calls.
2008-08-02 15:51:12 +00:00
robertmh
a927cc7383 2008-08-02 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (playground, forward_relocator)
        (backward_relocator): New variables.  Used to allocate and relocate
        the payload, respectively.
        (grub_multiboot_load_elf32): Load into heap instead of requested
        address, install the appropiate relocator code in each bound of
        the payload, and set the entry point such that
        grub_multiboot_real_boot() will jump to one of them.

        * kern/i386/loader.S (grub_multiboot_payload_size)
        (grub_multiboot_payload_orig, grub_multiboot_payload_dest)
        (grub_multiboot_payload_entry_offset): New variables.
        (grub_multiboot_real_boot): Set cpu context to what the relocator
        expects, and jump to the relocator instead of the payload.

        * include/grub/i386/loader.h (grub_multiboot_payload_size)
        (grub_multiboot_payload_orig, grub_multiboot_payload_dest)
        (grub_multiboot_payload_entry_offset): Export.
2008-08-02 12:12:14 +00:00
robertmh
3d8383e7a5 2008-07-31 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): When loading
        ELF segments, use a macro for arbitrarily accessing any of them instead
        of preparing a pointer that allows access to one at a time.
        (grub_multiboot_load_elf64): Likewise.
2008-07-31 20:48:40 +00:00
bean
2001169405 2008-07-17 Bean <bean123ch@gmail.com>
* conf/i386/efi.rmk (pkglib_MODULES): add pci.mod and lspci.mod.
	(appleldr_mod_SOURCE): New variavle.
	(appleldr_mod_CFLAGS): Likewise.
	(appleldr_mod_LDFLAGS): Likewise.
	(pci_mod_SOURCES): Likewise.
	(pci_mod_CFLAGS): Likewise.
	(pci_mod_LDFLAGS): Likewise.
	(lspci_mod_SOURCES): Likewise.
	(lspci_mod_CFLAGS): Likewise.
	(lspci_mod_LDFLAGS): Likewise.

	* conf/x86_64-efi.rmk: New file.

	* disk/efi/efidisk.c (grub_efidisk_read): Wrap efi calls with efi_call_N
	macro.
	(grub_efidisk_write): Likewise.

	* include/efi/api.h (efi_call_0): New macro.
	(efi_call_1): Likewise.
	(efi_call_2): Likewise.
	(efi_call_3): Likewise.
	(efi_call_4): Likewise.
	(efi_call_5): Likewise.
	(efi_call_6): Likewise.

	* include/grub/efi/chainloader.h (grub_chainloader_cmd): Rename to
	grub_rescue_cmd_chainloader.

	* include/grub/efi/pe32.h (GRUB_PE32_MACHINE_X86_64): New macro.
	(grub_pe32_optional_header): Change some fields based on i386 or
	x86_64 platform.
	(GRUB_PE32_PE32_MAGIC): Likewise.

	* include/grub/efi/uga_draw.h: New file.

	* include/grub/elf.h (STN_ABS): New constant.
	(R_X86_64_NONE): Relocation constant for x86_64.
	(R_X86_64_64): Likewise.
	(R_X86_64_PC32): Likewise.
	(R_X86_64_GOT32): Likewise.
	(R_X86_64_PLT32): Likewise.
	(R_X86_64_COPY): Likewise.
	(R_X86_64_GLOB_DAT): Likewise.
	(R_X86_64_JUMP_SLOT): Likewise.
	(R_X86_64_RELATIVE): Likewise.
	(R_X86_64_GOTPCREL): Likewise.
	(R_X86_64_32): Likewise.
	(R_X86_64_32S): Likewise.
	(R_X86_64_16): Likewise.
	(R_X86_64_PC16): Likewise.
	(R_X86_64_8): Likewise.
	(R_X86_64_PC8): Likewise.

	* include/grub/i386/efi/pci.h: New file.

	* include/grub/i386/linux.h (GRUB_LINUX_EFI_SIGNATURE):
	Change it value based on platform.
	(GRUB_LINUX_EFI_SIGNATURE_0204): New constant.
	(GRUB_E820_RAM): Likewise.
	(GRUB_E820_RESERVED): Likewise.
	(GRUB_E820_ACPI): Likewise.
	(GRUB_E820_NVS): Likewise.
	(GRUB_E820_EXEC_CODE): Likewise.
	(GRUB_E820_MAX_ENTRY): Likewise.
	(grub_e820_mmap): New structure.
	(linux_kernel_header): Change the efi field according to different
	kernel version, also field from linux_kernel_header.

	* include/grub/kernel.h (grub_module_info): Add padding for x86_64.

	* include/grub/pci.h (GRUB_PCI_ADDR_SPACE_MASK): New constant.
	(GRUB_PCI_ADDR_SPACE_MEMORY): Likewise.
	(GRUB_PCI_ADDR_SPACE_IO): Likewise.
	(GRUB_PCI_ADDR_MEM_TYPE_MASK): Likewise.
	(GRUB_PCI_ADDR_MEM_TYPE_32): Likewise.
	(GRUB_PCI_ADDR_MEM_TYPE_1M): Likewise.
	(GRUB_PCI_ADDR_MEM_TYPE_64): Likewise.
	(GRUB_PCI_ADDR_MEM_PREFETCH): Likewise.
	(GRUB_PCI_ADDR_MEM_MASK): Likewise.
	(GRUB_PCI_ADDR_IO_MASK): Likewise.

	* include/grub/x86_64/efi/kernel.h: New file.

	* include/grub/x86_64/efi/loader.h: Likewise.

	* include/grub/x86_64/efi/machine.h: Likewise.

	* include/grub/x86_64/efi/pci.h: Likewise.

	* include/grub/x86_64/efi/time.h: Likewise.

	* include/grub/x86_64/linux.h: Likewise.

	* include/grub/x86_64/setjmp.h: Likewise.

	* include/grub/x86_64/time.h: Likewise.

	* include/grub/x86_64/types.h: Likewise.

	* kern/dl.c (GRUB_CPU_SIZEOF_VOID_P): Changed to
	 GRUB_TARGET_SIZEOF_VOID_P.

	* kern/efi/efi.c (grub_efi_locate_protocol): Wrap efi calls.
	(grub_efi_locate_handle): Likewise.
	(grub_efi_open_protocol): Likewise.
	(grub_efi_set_text_mode): Likewise.
	(grub_efi_stall): Likewise.
	(grub_exit): Likewise.
	(grub_reboot): Likewise.
	(grub_halt): Likewise.
	(grub_efi_exit_boot_services): Likewise.
	(grub_get_rtc): Likewise.

	* kern/efi/mm.c (MEMORY_MAP_SIZE): Change to 0x3000 for new models.
	(GRUB_CPU_SIZEOF_VOID_P): Changed to GRUB_TARGET_SIZEOF_VOID_P.
	(grub_efi_allocate_pages): Wrap efi calls.
	(grub_efi_free_pages): Wrap efi calls.
	(grub_efi_get_memory_map): Wrap efi calls.

	* kern/x86_64/dl.c: New file.

	* kern/x86_64/efi/callwrap.S: Likewise.

	* kern/x86_64/efi/startup.S: Likewise.

	* loader/efi/appleloader.c: Likewise.

	* loader/efi/chainloader.c (cmdline): New variable.
	(grub_chainloader_unload): Wrap efi calls.
	(grub_chainloader_boot): Likewise.
	(grub_rescue_cmd_chainloader): Wrap efi calls, handle
	command line.

	* loader/efi/chainloader_normal.c (chainloader_command):
	Change grub_chainloader_cmd to grub_rescue_cmd_chainloader, pass
	command line.

	* loader/i386/efi/linux.c (allocate_pages): Change allocation
	method.
	(grub_e820_add_region): New function.
	(grub_linux_boot): Construct e820 map from efi map, handle x86_64
	booting.
	(grub_find_video_card): New function.
	(grub_linux_setup_video): New function.
	(grub_rescue_cmd_linux): Probe for video information.

	* normal/x86_64/setjmp.S: New file.

	* term/efi/console.c (map_char): New function.
	(grub_console_putchar): Map unicode char.
	(grub_console_checkkey): Wrap efi calls.
	(grub_console_getkey): Likewise.
	(grub_console_getwh): Likewise.
	(grub_console_gotoxy): Likewise.
	(grub_console_cls): Likewise.
	(grub_console_setcolorstate): Likewise.
	(grub_console_setcursor): Likewise.

	* util/i386/efi/grub-mkimage.c: Add support for x86_64.
2008-07-17 09:50:26 +00:00
proski
ef29405511 2008-07-16 Pavel Roskin <proski@gnu.org>
* loader/i386/efi/linux.c (allocate_pages): Fix warnings in
	format strings.
2008-07-16 07:06:11 +00:00
proski
8804b286f4 2008-07-15 Pavel Roskin <proski@gnu.org>
* loader/i386/ieee1275/linux.c (grub_set_bootpath): Remove.
	It's empty and unused.
2008-07-15 04:17:48 +00:00
proski
10b159d1b2 2008-07-01 Pavel Roskin <proski@gnu.org>
* loader/i386/pc/linux.c (grub_rescue_cmd_linux): Remove useless
	cast to fix a warning.
2008-07-02 00:39:55 +00:00
proski
b8789f6c20 2008-07-01 Pavel Roskin <proski@gnu.org>
* loader/i386/pc/multiboot2.c (grub_mb2_arch_module_alloc): Use
	cast to suppress a warning.
2008-07-02 00:37:48 +00:00
bean
25f16ec1f6 2008-04-25 Bean <bean123ch@gmail.com>
* Makefile.in (RMKFILES): Add missing arch i386-ieee1275 and
	i386-linuxbios.

	* commands/hexdump.c (grub_cmd_hexdump): Support dumping of device,
	change the buffer size to 4096 for cdrom device.

	* conf/i386-ieee1275.rmk (pkglib_MODULES): Add _linux.mod, linux.mod
	and nand.mod.
	(_linux_mod_SOURCES): New variable.
	(_linux_mod_CFLAGS): Likewise.
	(_linux_mod_LDFLAGS): Likewise.
	(linux_mod_SOURCES): Likewise.
	(linux_mod_CFLAGS): Likewise.
	(linux_mod_LDFLAGS): Likewise.
	(nand_mod_SOURCES): Likewise.
	(nand_mod_CFLAGS): Likewise.
	(nand_mod_LDFLAGS): Likewise.

	* disk/ieee1275/ofdisk.c (grub_ofdisk_open): Return
	GRUB_ERR_UNKNOWN_DEVICE instead of GRUB_ERR_BAD_DEVICE if no device
	type property. (nand device in olpc don't have this property)

	* include/grub/disk.h (grub_disk_dev_id): New macro
	GRUB_DISK_DEVICE_NAND_ID.

	* include/grub/i386/ieee1275/loader.h (grub_rescue_cmd_linux): New
	function prototype.
	(grub_rescue_cmd_initrd): Likewise.

	* include/grub/i386/linux.h (GRUB_LINUX_OFW_SIGNATURE): New macro.
	(linux_kernel_params): Add new member ofw_signature, ofw_num_items,
	ofw_cif_handler and ofw_idt, adjust padding number.

	* include/grub/i386/pc/memory.h (grub_upper_mem): Export it if
	GRUB_MACHINE_IEEE1275 is defined.

	* include/grub/ieee1275/ieee1275.h (grub_available_iterate):
	Use NESTED_FUNC_ATTR attribute on the hook parameter.

	* kern/powerpc/ieee1275/init.c (grub_claim_heap): Use NESTED_FUNC_ATTR
	on nested function heap_init.
	(grub_upper_mem): New variable for i386-ieee1275.
	(grub_get_extended_memory): New function for i386-ieee1275.
	(grub_machine_init): Call grub_get_extended_memory for i386-ieee1275.

	* kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Use
	NESTED_FUNC_ATTR on the hook parameter. Don't quit if no device type
	property.

	* loader/i386/ieee1275/linux.c: New file.

	* loader/i386/ieee1275/linux_normal.c: New file.

	* disk/ieee1275/nand.c: New file.
2008-04-25 19:41:51 +00:00
proski
9a3f3296d5 2008-03-30 Pavel Roskin <proski@gnu.org>
* loader/i386/pc/multiboot2.c (grub_mb2_arch_elf64_hook): Add
	missing grub_error() call.
2008-03-30 16:17:17 +00:00
proski
0bf6d401c1 2008-03-30 Pavel Roskin <proski@gnu.org>
* commands/sleep.c: Fix warning about implicit declaration.
	* disk/memdisk.c: Likewise.
	* loader/aout.c: Likewise.
	* loader/i386/bsd_normal.c: Likewise.
	* util/grub-probe.c: Likewise.
2008-03-30 06:13:45 +00:00
bean
38ad2cf5a5 2008-03-05 Bean <bean123ch@gmail.com>
* loader/i386/pc/multiboot.c (grub_multiboot_get_bootdev): New function.
	(grub_multiboot): Set boot device.

	* boot/i386/pc/lnxboot.S (real_code_2): Set %dh to 0xFF.
2008-03-05 05:09:35 +00:00
bean
d38e24c285 2008-02-19 Bean <bean123ch@gmail.com>
* conf/i386-pc.rmk (pkglib_MODULES): Add aout.mod _bsd.mod and bsd.mod.
	(aout_mod_SOURCES): New variable.
	(aout_mod_CFLAGS): Likewise.
	(aout_mod_LDFLAGS): Likewise.
	(_bsd_mod_SOURCES): New variable.
	(_bsd_mod_CFLAGS): Likewise.
	(_bsd_mod_LDFLAGS): Likewise.
	(bsd_mod_SOURCES): New variable.
	(bsd_mod_CFLAGS): Likewise.
	(bsd_mod_LDFLAGS): Likewise.

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

	* include/grub/i386/loader.h (grub_unix_real_boot): New function.

	* include/grub/i386/bsd.h: New file.

	* include/grub/i386/pc/init.h (grub_get_mmap_entry): Use EXPORT_FUNC
	to make it public.

	* kern/elf.c (grub_elf32_load): Get the physical address after the hook
	function is called, so that it's possible to change it inside the hook.
	(grub_elf64_load): Likewise.
	(grub_elf_file): Don't close the file if elf header is not found.
	(grub_elf_close): Close the file if grub_elf_file fails (The new
	grub_elf_file won't close it).
	(grub_elf32_size): Use NESTED_FUNC_ATTR for nested function calcsize.
	(grub_elf64_size): Likewise.

	* kern/i386/loader.S (grub_unix_real_boot): New function.

	* loader/aout.c: New file.

	* loader/i386/bsd.c: New file.

	* loader/i386/bsd_normal.c: New file.

	* loader/i386/pc/multiboot.c (grub_multiboot): Handle a.out format.

	* loader/multiboot2.c (grub_multiboot2): Reset grub_errno so that it
	can test othe formats.
2008-02-19 16:40:45 +00:00
robertmh
b37a922267 2008-02-08 Robert Millan <rmh@aybabtu.com>
* disk/raid.c: Update copyright.
        * fs/cpio.c: Likewise.
        * include/grub/raid.h: Likewise.
        * loader/i386/pc/multiboot.c: Likewise.
        * util/hostfs.c: Likewise.
2008-02-08 21:27:55 +00:00