Commit Graph

16 Commits

Author SHA1 Message Date
okuji f4917dfdd6 2005-08-07 Yoshinori K. Okuji <okuji@enbug.org>
* kern/rescue.c (grub_rescue_cmd_rmmod): If the reference count is
        negative, unload the module.

        * util/i386/pc/grub-setup.c (setup): The name of the PC partition
        map is "pc_partition_map" but not "pc".
        (usage): Fix the description. The options are --boot-image and
        --core-image but not --boot-file or --core-file.
        (main): If not specified explicitly, make BOOT_FILE and CORE_FILE
        based on DEFAULT_BOOT_FILE and DEFAULT_CORE_FILE with DIR or
        DEFAULT_DIRECTORY.

        * util/i386/pc/grub-install.in: Do not specify --boot-file or
        --core-file. Specify INSTALL_DEVICE as an argument.

        * util/console.c: Include config.h.
        [HAVE_NCURSeS_CURSES_H]: Include ncurses/curses.h.
        [HAVE_NCURSES_H]: Include ncurses.h.
        [HAVE_CURSES_H]: Include curses.h.
        [!A_NORMAL] (A_NORMAL): Defined as zero.
        [!A_STANDOUT] (A_STANDOUT): Likewise.

        * conf/i386-pc.rmk (grub_emu_LDFLAGS): Use $(LIBCURSES) instead of
        -lncurses.
        * conf/powerpc-ieee1275.rmk (grub_emu_LDFLAGS): Likewise.

        * configure.ac: Check for curses libraries and headers.

        * Makefile.in (LIBCURSES): New variable.

        * genmk.rb (Script::rule): Set the executable bits.

        * util/i386/pc/biosdisk.c (grub_util_biosdisk_get_grub_dev): The
        name of the PC partition map is "pc_partition_map" but not "pc".
2005-08-07 17:12:52 +00:00
okuji 075a165076 2005-07-24 Yoshinori K. Okuji <okuji@enbug.org>
* DISTLIST: Added util/i386/pc/grub-install.in.

	* util/i386/pc/grub-install.in: New file.

	* conf/i386-pc.rmk (sbin_SCRIPTS): New variable.
	(grub_install_SOURCES): Likewise.

	* genmk.rb: Added support for scripts.
	(Script): New class.
	(scripts): New variable.

	* Makefile.in (install-local): Install sbin_SCRIPTS by
	INSTALL_SCRIPT.
	(uninstall): Remove sbin_SCRIPTS.

	* util/i386/pc/grub-setup.c (main): If the argument is not a GRUB
	device, try to get a GRUB device by
	grub_util_biosdisk_get_grub_dev.
	Free DEST_DEV.

	* util/i386/pc/grub-mkdevicemap.c (usage): Remove a duplicated
	description for --device-map.
2005-07-24 18:16:26 +00:00
okuji 39c9d41d2a 2005-07-03 Yoshinori Okuji <okuji@enbug.org>
* DISTLIST: Added genfslist.sh.

	* normal/main.c (fs_module_list): New variable.
	(autoload_fs_module): New function.
	(read_fs_list): Likewise.
	(grub_normal_execute): Call read_fs_list.

	* kern/fs.c (grub_fs_autoload_hook): New variable.
	(grub_fs_probe): Added support for auto-loading.

	* include/grub/normal.h (struct grub_fs_module_list): New struct.
	(grub_fs_module_list_t): New type.

	* include/grub/fs.h (grub_fs_autoload_hook_t): New type.
	(grub_fs_autoload_hook): New prototype.

	* genfslist.sh: New file.

	* genmk.rb: Added a rule to generate a filesystem list.
2005-07-03 18:06:56 +00:00
marco_g 121c1d832e 2005-06-30 Marco Gerards <metgerards@student.han.nl>
* configure.ac: Fix the test for cross-compiling.

	* genmk.rb (Program): Use `$(CC)' instead of `$(BUILD_CC)'.  Don't
	define GRUB_UTIL anymore.

	* util/powerpc/ieee1275/grub-mkimage.c (load_note): Endian fixes
	so this function works on other systems than just big endian.
	(load_modules): Likewise.
	(add_segments): Likewise.
2005-06-30 10:21:37 +00:00
okuji 5822ff87a2 2005-03-08 Yoshinori Okuji <okuji@enbug.org>
Automatic loading of commands is supported.

  * normal/main.c (read_command_list): New function.
  (grub_normal_execute): Call read_command_list.

  * normal/command.c (grub_register_command): Return zero or CMD.
  Allocate CMD->NAME from the heap.
  Initialize CMD->MODULE_NAME to zero.
  Find the same name as well. If the same command is found and it is
  a dummy command, overwrite members. If it is not a dummy command,
  return zero.
  (grub_unregister_command): Free Q->NAME and Q->MODULE_NAME.
  (grub_command_find): If a dummy command is found, load a module
  and retry to find a command only once.

  * normal/cmdline.c (grub_tab_complete): Call grub_command_find to
  make sure that each command is loaded.

  * include/grub/normal.h (GRUB_COMMAND_FLAG_NOT_LOADED): New
  macro.
  (struct grub_command): Remove const from the member `name'.
  Add a new member `module_name'.
  (grub_register_command): Return grub_command_t.

  * commands/help.c (grub_cmd_help): Call grub_command_find to make
  sure that each command is loaded.

  * genmk.rb (PModule::rule): Specify a module name without the
  suffix ".mod" to gencmdlist.sh.
2005-03-08 01:01:06 +00:00
okuji 7b1f4b5715 2005-03-02 Yoshinori K. Okuji <okuji@enbug.org>
* gencmdlist.sh: New file.

  * genmk.rb (PModule::rule): Generate a rule for a command list.
  Clean command.lst.
  Generate command.lst from $(COMMANDFILES).

  * Makefile.in (COMMON_DISTFILES): Added gencmdlist.sh.
  (DATA): Added $(pkgdata_DATA).
  (install-local): Install files in $(pkgdata_DATA).
2005-03-02 21:52:38 +00:00
marco_g b38551dabe 2005-01-20 Timothy Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
* include/grub/dl.h (GRUB_MOD_INIT): Changed `__attribute__
	((unused))' to `__attribute__ ((used))'.
	(GRUB_MOD_FINI): Likewise.
	* kern/dl.c (grub_dl_load_file): Fix null pointer dereference.
	* genmk.rb (PModule): Assign space to common symbols when linking
	modules.
2005-01-20 17:33:09 +00:00
marco_g 924b6140a1 2004-12-27 Marco Gerards <metgerards@student.han.nl>
* genmk.rb: Handle the `Program' class in the main loop.  Written
	by Johan Rydberg <jrydberg@gnu.org>.
	(Program): New class.
	(programs): New variable.
	* boot/powerpc/ieee1275/cmain.c: Include <grub/machine/ieee1275.h>
	instead of "grub/machine/ieee1275.h".  Include <grub/kernel.h>
	instead of "grub/kernel.h".  Include <grub/machine/init.h>.
	(help_arch): Function removed.
	* conf/powerpc-ieee1275.rmk (grubof_HEADERS): Add
	`powerpc/libgcc.h' and `loader.h'.
	(pkgdata_PROGRAMS): New variable.
	(sbin_UTILITIES): Variable removed.
	(grub_emu_SOURCES): Added kern/powerpc/cache.S.
	(grubof_SOURCES): Variable re-defined so it only includes the
	core functionality.
	(grubof_CFLAGS): Remove `-DGRUBOF'.
	(pkgdata_MODULES, fshelp_mod_SOURCES, fshelp_mod_CFLAGS,
	(fat_mod_SOURCES, fat_mod_CFLAGS, ext2_mod_SOURCES)
	(ext2_mod_CFLAGS, ufs_mod_SOURCES, ufs_mod_CFLAGS)
	(minix_mod_SOURCES, minix_mod_CFLAGS, hfs_mod_SOURCES)
	(hfs_mod_CFLAGS, jfs_mod_SOURCES, jfs_mod_CFLAGS)
	(iso9660_mod_SOURCES, iso9660_mod_CFLAGS, _linux_mod_SOURCES)
	(_linux_mod_CFLAGS, linux_mod_SOURCES, linux_mod_CFLAGS)
	(normal_mod_SOURCES, normal_mod_CFLAGS, normal_mod_ASFLAGS)
	(hello_mod_SOURCES, hello_mod_CFLAGS, boot_mod_SOURCES)
	(boot_mod_CFLAGS, terminal_mod_SOURCES, terminal_mod_CFLAGS)
	(ls_mod_SOURCES, ls_mod_CFLAGS, cmp_mod_SOURCES, cmp_mod_CFLAGS)
	(cat_mod_SOURCES, cat_mod_CFLAGS, font_mod_SOURCES)
	(font_mod_CFLAGS, amiga_mod_SOURCES, amiga_mod_CFLAGS)
	(apple_mod_SOURCES, apple_mod_CFLAGS, pc_mod_SOURCES)
	(pc_mod_CFLAGS): New variables.
	* disk/powerpc/ieee1275/ofdisk.c: Include <grub/machine/init.h>.
	(grub_ofdisk_iterate): Add a prototype for `dev_iterate'.
	* include/grub/dl.h (grub_arch_dl_sync_caches): New prototype.
	* include/grub/loader.h (grub_os_area_addr, grub_os_area_size):
	Moved from here...
	* include/grub/i386/pc/init.h (grub_os_area_addr)
	(rub_os_area_size): ... to here.
	* include/grub/powerpc/ieee1275/ieee1275.h
	(grub_ieee1275_entry_fn): Export symbol.
	* include/grub/powerpc/ieee1275/init.h: New file.
	* include/grub/powerpc/libgcc.h: Likewise.
	* include/grub/cache.h: Likewise.
	* kern/powerpc/cache.S: Likewise.  Written by Hollis Blanchard
	<hollis@penguinppc.org>.
	* kern/dl.c: Include <grub/cache.h>.
	(grub_dl_flush_cache): New function.
	(grub_dl_load_core): Call `grub_dl_flush_cache' to flush the cache
	for this module.
	* kern/powerpc/ieee1275/init.c (grub_ofdisk_init)
	(grub_console_init): Removed prototypes.
	(grub_machine_init): Don't initialize the modules anymore.
	* kern/powerpc/ieee1275/openfw.c (grub_map): Make the function
	static.
	* include/grub/powerpc/types.h (GRUB_HOST_WORDS_LITTLEENDIAN):
	Macro undef removed.
	(GRUB_HOST_WORDS_BIGENDIAN): New macro.
	* kern/powerpc/dl.c (grub_arch_dl_relocate_symbols): Add
	relocation `R_PPC_REL32'.  Return an error when the relocation is
	unknown.
	* Makefile.in (DATA): Add `$(pkgdata_PROGRAMS)'.
	* kern/i386/pc/init.c (grub_arch_sync_caches): New function.
	* util/misc.c (grub_arch_sync_caches): Likewise.
2004-12-27 13:46:20 +00:00
okuji 4b13b216f4 2004-04-04 Yoshinori K. Okuji <okuji@enbug.org>
All symbols prefixed with PUPA_ and pupa_ are renamed to GRUB_
	and grub_, respectively. Because the conversion is trivial and
	mechanical, I omit the details here. Please refer to the CVS
	if you need more information.
2004-04-04 13:46:03 +00:00
marco_g e56cdf2111 2004-03-29 Marco Gerards <metgerards@student.han.nl>
Add support for the newworld apple macintosh (PPC).  This has been
	tested on the powerbook 2000 only.  It only adds support for
	generic ieee1275 functions, console and disk support.  This should
	be easy to port to other architectures with support for Open
	Firmware.

	* configure.ac: Accept the powerpc as host_cpu.  In the case of
	the powerpc cpu set the host_vendor to ieee1275.  Make sure the i386
	specific tests are only executed while building for the i386.
	Inverse test for crosscompile.
	* genmk.rb (Utility): Allow assembler files.
	* normal/cmdline.c (pupa_tab_complete): Reset pupa_errno.
	* conf/powerpc-ieee1275.rmk: New file.
	* disk/powerpc/ieee1275/ofdisk.c: Likewise.
	* disk/powerpc/ieee1275/partition.c: Likewise.
	* include/pupa/powerpc/ieee1275/biosdisk.h: Likewise.
	* include/pupa/powerpc/ieee1275/console.h: Likewise.
	* include/pupa/powerpc/ieee1275/partition.h: Likewise.
	* include/pupa/powerpc/ieee1275/time.h: Likewise.
	* include/pupa/powerpc/ieee1275/util/biosdisk.h: Likewise.
	* include/pupa/powerpc/ieee1275/multiboot.h: Likewise.
	* include/pupa/powerpc/ieee1275/loader.h
	* include/pupa/powerpc/setjmp.h: Likewise.
	* include/pupa/powerpc/types.h: Likewise.
	* kern/powerpc/ieee1275/init.c: Likewise.
	* kern/powerpc/ieee1275/openfw.c: Likewise.
	* term/powerpc/ieee1275/ofconsole.c: Likewise.

	These files were written by Johan Rydberg
	(jrydberg@night.trouble.net) and I only modified them slightly.

	* boot/powerpc/ieee1275/cmain.c: New file.
	* boot/powerpc/ieee1275/crt0.S: Likewise.
	* boot/powerpc/ieee1275/ieee1275.c: Likewise.
	* include/pupa/powerpc/ieee1275/ieee1275.h: Likewise.
2004-03-28 21:52:02 +00:00
okuji 8367695cff shinori K. Okuji <okuji@enbug.org>
* genkernsyms.sh: Updated copyright information.
	* genmk.rb: Likewise.
	* genmodsrc.sh: Likewise.
	* gensymlist.sh: Likewise.
	* boot/i386/pc/boot.S: Likewise.
	* boot/i386/pc/diskboot.S: Likewise.
	* disk/i386/pc/biosdisk.c: Likewise.
	* disk/i386/pc/partition.c: Likewise.
	* font/manager.c: Likewise.
	* fs/ext2.c: Likewise.
	* fs/fat.c: Likewise.
	* include/pupa/boot.h: Likewise.
	* include/pupa/device.h: Likewise.
	* include/pupa/disk.h: Likewise.
	* include/pupa/dl.h: Likewise.
	* include/pupa/elf.h: Likewise.
	* include/pupa/err.h: Likewise.
	* include/pupa/file.h: Likewise.
	* include/pupa/font.h: Likewise.
	* include/pupa/fs.h: Likewise.
	* include/pupa/kernel.h: Likewise.
	* include/pupa/loader.h: Likewise.
	* include/pupa/misc.h: Likewise.
	* include/pupa/mm.h: Likewise.
	* include/pupa/net.h: Likewise.
	* include/pupa/normal.h: Likewise.
	* include/pupa/rescue.h: Likewise.
	* include/pupa/setjmp.h: Likewise.
	* include/pupa/symbol.h: Likewise.
	* include/pupa/term.h: Likewise.
	* include/pupa/types.h: Likewise.
	* include/pupa/i386/setjmp.h: Likewise.
	* include/pupa/i386/types.h: Likewise.
	* include/pupa/i386/pc/biosdisk.h: Likewise.
	* include/pupa/i386/pc/boot.h: Likewise.
	* include/pupa/i386/pc/console.h: Likewise.
	* include/pupa/i386/pc/init.h: Likewise.
	* include/pupa/i386/pc/kernel.h: Likewise.
	* include/pupa/i386/pc/linux.h: Likewise.
	* include/pupa/i386/pc/loader.h: Likewise.
	* include/pupa/i386/pc/memory.h: Likewise.
	* include/pupa/i386/pc/multiboot.h: Likewise.
	* include/pupa/i386/pc/partition.h: Likewise.
	* include/pupa/i386/pc/time.h: Likewise.
	* include/pupa/i386/pc/vga.h: Likewise.
	* include/pupa/i386/pc/util/biosdisk.h: Likewise.
	* include/pupa/util/getroot.h: Likewise.
	* include/pupa/util/misc.h: Likewise.
	* include/pupa/util/resolve.h: Likewise.
	* kern/device.c: Likewise.
	* kern/disk.c: Likewise.
	* kern/dl.c: Likewise.
	* kern/err.c: Likewise.
	* kern/file.c: Likewise.
	* kern/fs.c: Likewise.
	* kern/loader.c: Likewise.
	* kern/main.c: Likewise.
	* kern/misc.c: Likewise.
	* kern/mm.c: Likewise.
	* kern/rescue.c: Likewise.
	* kern/term.c: Likewise.
	* kern/i386/dl.c: Likewise.
	* kern/i386/pc/init.c: Likewise.
	* kern/i386/pc/lzo1x.S: Likewise.
	* kern/i386/pc/startup.S: Likewise.
	* loader/i386/pc/chainloader.c: Likewise.
	* loader/i386/pc/linux.c: Likewise.
	* loader/i386/pc/multiboot.c: Likewise.
	* normal/cmdline.c: Likewise.
	* normal/command.c: Likewise.
	* normal/main.c: Likewise.
	* normal/menu.c: Likewise.
	* normal/i386/setjmp.S: Likewise.
	* term/i386/pc/console.c: Likewise.
	* term/i386/pc/vga.c: Likewise.
	* util/console.c: Likewise.
	* util/genmoddep.c: Likewise.
	* util/misc.c: Likewise.
	* util/pupa-emu.c: Likewise.
	* util/resolve.c: Likewise.
	* util/unifont2pff.rb: Likewise.
	* util/i386/pc/biosdisk.c: Likewise.
	* util/i386/pc/getroot.c: Likewise.
	* util/i386/pc/pupa-mkimage.c: Likewise.
	* util/i386/pc/pupa-setup.c: Likewise.
2004-02-24 17:21:53 +00:00
okuji 98d150633e 2003-09-25 Yoshinori K. Okuji <okuji@enbug.org>
* genmk.rb (PModule#rule): Make sure to get only symbol names
	from the output of nm.
	Reported by Robert Millan <zeratul2@wanadoo.es>.
2003-09-25 20:29:32 +00:00
okuji 1f5ab4280a 2003-01-31 Yoshinori K. Okuji <okuji@enbug.org>
* kern/i386/pc/lzo1x.S: New file.

	* util/i386/pc/pupa-mkimage.c: Include lzo1x.h.
	(compress_kernel): New variable.
	(generate_image): Heavily modified to support compressing a
	large part of the core image.

	* util/misc.c (pupa_util_read_image): Fix a file descriptor
	leak.
	(pupa_util_load_image): New function.

	* kern/i386/pc/startup.S: Include pupa/machine/kernel.h.
	(pupa_compressed_size): New variable.
	(codestart): Enable Gate A20 here.
	Decompress the compressed part of the core image.
	Rearrange the code to put functions and variables which are
	required for initialization in the non-compressed part.
	Include lzo1x.S.

	* kern/i386/pc/init.c (pupa_machine_init): Don't enable Gate A20
	here.

	* include/pupa/util/misc.h (pupa_util_write_image): Declared.

	* include/pupa/i386/pc/kernel.h
	(PUPA_KERNEL_MACHINE_COMPRESSED_SIZE): New macro.
	(PUPA_KERNEL_MACHINE_INSTALL_DOS_PART): Increased by 4.
	(PUPA_KERNEL_MACHINE_INSTALL_BSD_PART): Likewise.
	(PUPA_KERNEL_MACHINE_PREFIX): Likewise.
	(PUPA_KERNEL_MACHINE_RAW_SIZE): New macro.

	* conf/i386-pc.rmk (pupa_mkimage_LDFLAGS): New variable.

	* genmk.rb (Image#rule): Put LDFLAGS at the end of a line.
	(Utility#rule): Likewise.

	* configure.ac: Check if LZO is available.
2003-01-31 03:26:56 +00:00
okuji 1cc73a62da 2003-01-03 Yoshinori K. Okuji <okuji@enbug.org>
* include/i386/pc/util/biosdisk.h: New file.
	* util/i386/pc/biosdisk.c: Likewise.
	* util/i386/pc/pupa-setup.c: Likewise.

	* Makefile.in (INCLUDE_DISTFILES): Added
	include/pupa/i386/pc/util/biosdisk.h.
	(UTIL_DISTFILES): Added biosdisk.c and pupa-setup.c under the
	directory util/i386/pc.
	(install-local): Added a rule for sbin_UTILITIES.
	(uninstall): Likewise.

	* util/i386/pc/pupa-mkimage.c (usage): Fix a typo in the doc.

	* util/misc.c (xrealloc): New function.
	(pupa_malloc): Likewise.
	(pupa_free): Likewise.
	(pupa_realloc): Likewise.
	(pupa_stop): Likewise.
	(pupa_putchar): Likewise.

	* kern/disk.c (pupa_disk_read): Prevent L from underflowing.

	* include/pupa/util/misc.h (xrealloc): Declared.

	* include/pupa/i386/pc/boot.h (PUPA_BOOT_MACHINE_BPB_START): New
	macro.
	(PUPA_BOOT_MACHINE_BPBEND): Renamed to ...
	(PUPA_BOOT_MACHINE_BPB_END): ... this.

	* include/pupa/fs.h [PUPA_UTIL] (pupa_fat_init): Declared.
	[PUPA_UTIL] (pupa_fat_fini): Likewise.

	* fs/fat.c [PUPA_UTIL] (pupa_fat_init): Defined. Maybe a better
	way should be implemented.
	[PUPA_UTIL] (pupa_fat_fini): Likewise.

	* disk/i386/pc/biosdisk.c (pupa_biosdisk_call_hook): Increase
	the size of NAME for safety.
	(pupa_biosdisk_iterate): Search hard disks to 0x90 instead of
	0x88.

	* conf/i386-pc.rmk (sbin_UTILITIES): New variable.
	(pupa_setup_SOURCES): Likewise.

	* genmk.rb (Utility#rule): Add $(BUILD_CFLAGS) into the rules.
2003-01-02 20:12:33 +00:00
okuji 62ddcc8f79 2002-12-28 Yoshinori K. Okuji <okuji@enbug.org>
Use -mrtd and -mregparm=3 to reduce the generated code sizes.
	This means that any missing prototypes could be fatal. Also, you
	must take care when writing assembly code. See the comments at
	the beginning of startup.S, for more details.

	* kern/i386/pc/startup.S (pupa_halt): Modified for the new
	compilation mechanism.
	(pupa_chainloader_real_boot): Likewise.
	(pupa_biosdisk_rw_int13_extensions): Likewise.
	(pupa_biosdisk_rw_standard): Likewise.
	(pupa_biosdisk_check_int13_extensions): Likewise.
	(pupa_biosdisk_get_diskinfo_int13_extensions): Likewise.
	(pupa_biosdisk_get_diskinfo_standard): Likewise.
	(pupa_get_memsize): Likewise.
	(pupa_get_mmap_entry): Likewise.
	(pupa_console_putchar): Likewise.
	(pupa_console_setcursor): Likewise.
	(pupa_getrtsecs): Use pushl instead of push.

	* kern/i386/pc/init.c (pupa_machine_init): Use the scratch
	memory instead of the stack for a mmap entry, because some
	BIOSes may ignore the maximum size and overflow.

	* conf/i386-pc.rmk (COMMON_CFLAGS): Added -mrtd and -mregparm=3.

	* genmk.rb (PModule#rule): Compile automatically generated
	sources with module-specific CFLAGS as well as other sources.
2002-12-28 07:16:30 +00:00
okuji 6a161fa938 Initial revision 2002-12-27 08:53:07 +00:00