From 4b13b216f4db3b10cd4aab9dc93008c95c116e1d Mon Sep 17 00:00:00 2001 From: okuji Date: Sun, 4 Apr 2004 13:46:03 +0000 Subject: [PATCH] 2004-04-04 Yoshinori K. Okuji 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. --- AUTHORS | 2 +- ChangeLog | 7 + INSTALL | 18 +- Makefile.in | 18 +- NEWS | 12 + README | 2 +- TODO | 6 +- aclocal.m4 | 168 +++--- boot/i386/pc/boot.S | 38 +- boot/i386/pc/diskboot.S | 22 +- boot/powerpc/ieee1275/cmain.c | 24 +- boot/powerpc/ieee1275/crt0.S | 2 +- boot/powerpc/ieee1275/ieee1275.c | 178 +++--- commands/boot.c | 46 +- commands/cat.c | 74 +-- commands/cmp.c | 88 +-- commands/ls.c | 168 +++--- commands/terminal.c | 72 +-- conf/i386-pc.mk | 552 ++++++++--------- conf/i386-pc.rmk | 26 +- conf/powerpc-ieee1275.mk | 556 +++++++++--------- conf/powerpc-ieee1275.rmk | 26 +- configure | 182 +++--- configure.ac | 24 +- disk/i386/pc/biosdisk.c | 228 +++---- disk/i386/pc/partition.c | 120 ++-- disk/powerpc/ieee1275/ofdisk.c | 108 ++-- disk/powerpc/ieee1275/partition.c | 68 +-- font/manager.c | 102 ++-- fs/ext2.c | 518 ++++++++-------- fs/fat.c | 500 ++++++++-------- genmk.rb | 6 +- genmodsrc.sh | 12 +- gensymlist.sh | 10 +- hello/hello.c | 28 +- include/grub/arg.h | 40 +- include/grub/boot.h | 16 +- include/grub/device.h | 38 +- include/grub/disk.h | 74 +-- include/grub/dl.h | 92 +-- include/grub/elf.h | 40 +- include/grub/env.h | 50 +- include/grub/err.h | 74 +-- include/grub/file.h | 54 +- include/grub/font.h | 14 +- include/grub/fs.h | 60 +- include/grub/i386/pc/biosdisk.h | 30 +- include/grub/i386/pc/boot.h | 46 +- include/grub/i386/pc/console.h | 52 +- include/grub/i386/pc/init.h | 36 +- include/grub/i386/pc/kernel.h | 40 +- include/grub/i386/pc/linux.h | 102 ++-- include/grub/i386/pc/loader.h | 40 +- include/grub/i386/pc/memory.h | 48 +- include/grub/i386/pc/multiboot.h | 138 ++--- include/grub/i386/pc/partition.h | 232 ++++---- include/grub/i386/pc/time.h | 10 +- include/grub/i386/pc/util/biosdisk.h | 18 +- include/grub/i386/pc/vga.h | 14 +- include/grub/i386/setjmp.h | 10 +- include/grub/i386/types.h | 18 +- include/grub/kernel.h | 32 +- include/grub/loader.h | 28 +- include/grub/misc.h | 78 +-- include/grub/mm.h | 28 +- include/grub/net.h | 46 +- include/grub/normal.h | 124 ++-- include/grub/powerpc/ieee1275/biosdisk.h | 30 +- include/grub/powerpc/ieee1275/console.h | 52 +- include/grub/powerpc/ieee1275/ieee1275.h | 104 ++-- include/grub/powerpc/ieee1275/loader.h | 40 +- include/grub/powerpc/ieee1275/multiboot.h | 138 ++--- include/grub/powerpc/ieee1275/partition.h | 72 +-- include/grub/powerpc/ieee1275/time.h | 10 +- include/grub/powerpc/ieee1275/util/biosdisk.h | 18 +- include/grub/powerpc/setjmp.h | 10 +- include/grub/powerpc/types.h | 18 +- include/grub/rescue.h | 16 +- include/grub/setjmp.h | 24 +- include/grub/symbol.h | 12 +- include/grub/term.h | 94 +-- include/grub/types.h | 164 +++--- include/grub/util/getroot.h | 16 +- include/grub/util/misc.h | 26 +- include/grub/util/resolve.h | 20 +- kern/device.c | 72 +-- kern/disk.c | 344 +++++------ kern/dl.c | 382 ++++++------ kern/env.c | 126 ++-- kern/err.c | 36 +- kern/file.c | 84 +-- kern/fs.c | 132 ++--- kern/i386/dl.c | 28 +- kern/i386/pc/init.c | 128 ++-- kern/i386/pc/lzo1x.S | 4 +- kern/i386/pc/startup.S | 266 ++++----- kern/loader.c | 56 +- kern/main.c | 86 +-- kern/misc.c | 198 +++---- kern/mm.c | 210 +++---- kern/powerpc/ieee1275/init.c | 64 +- kern/powerpc/ieee1275/openfw.c | 46 +- kern/rescue.c | 464 +++++++-------- kern/term.c | 170 +++--- loader/i386/pc/chainloader.c | 108 ++-- loader/i386/pc/linux.c | 282 ++++----- loader/i386/pc/multiboot.c | 228 +++---- normal/arg.c | 126 ++-- normal/cmdline.c | 264 ++++----- normal/command.c | 218 +++---- normal/i386/setjmp.S | 12 +- normal/main.c | 180 +++--- normal/menu.c | 112 ++-- term/i386/pc/console.c | 66 +-- term/i386/pc/vga.c | 132 ++--- term/powerpc/ieee1275/ofconsole.c | 172 +++--- util/console.c | 110 ++-- util/genmoddep.c | 2 +- util/grub-emu.c | 104 ++-- util/i386/pc/biosdisk.c | 160 ++--- util/i386/pc/getroot.c | 42 +- util/i386/pc/grub-mkimage.c | 132 ++--- util/i386/pc/grub-setup.c | 328 +++++------ util/misc.c | 76 +-- util/resolve.c | 32 +- 125 files changed, 6198 insertions(+), 6181 deletions(-) diff --git a/AUTHORS b/AUTHORS index 4b6a2f309..adfb7ce57 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,5 +6,5 @@ Yoshinori K. Okuji designed and implemented the initial version. Jeroen Dekkers added initrd support, Multiboot support, and fixed bugs in ext2fs. -Marco Gerards added ext2fs support, pupa-emu, a new command-line +Marco Gerards added ext2fs support, grub-emu, a new command-line engine, and fixed many bugs. diff --git a/ChangeLog b/ChangeLog index 6f19073fe..ada73e07c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-04-04 Yoshinori K. Okuji + + 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 Yoshinori K. Okuji * include/pupa: Renamed to ... diff --git a/INSTALL b/INSTALL index 4f6e79586..e98fc089d 100644 --- a/INSTALL +++ b/INSTALL @@ -1,15 +1,15 @@ -*- Text -*- -This is the PUPA. Welcome. +This is the GRUB. Welcome. -This file contains instructions for compiling and installing the PUPA. +This file contains instructions for compiling and installing the GRUB. The Requirements ================ -PUPA depends on some software packages installed into your system. If +GRUB depends on some software packages installed into your system. If you don't have any of them, please obtain and install them before -configuring the PUPA. +configuring the GRUB. * GCC 2.95 or later * GNU Make @@ -17,12 +17,12 @@ configuring the PUPA. * Other standard GNU/Unix tools * LZO 1.02 or later -If you'd like to develop PUPA, these below are also required. +If you'd like to develop GRUB, these below are also required. * Ruby 1.6 or later * Autoconf 2.53 or later -Configuring the PUPA +Configuring the GRUB ==================== The `configure' shell script attempts to guess correct values for @@ -46,7 +46,7 @@ called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. -Building the PUPA +Building the GRUB ================= The simplest way to compile this package is: @@ -111,10 +111,10 @@ If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. -Please note, however, that the PUPA knows where it is located in the +Please note, however, that the GRUB knows where it is located in the filesystem. If you have installed it in an unusual location, the system might not work properly, or at all. The chief utility of these -options for the PUPA is to allow you to "install" in some alternate +options for the GRUB is to allow you to "install" in some alternate location, and then copy these to the actual root filesystem later. diff --git a/Makefile.in b/Makefile.in index 7e9a14a36..1d0049012 100644 --- a/Makefile.in +++ b/Makefile.in @@ -60,7 +60,7 @@ CPPFLAGS = -I. -Iinclude -I$(srcdir)/include -Wall -W BUILD_CC = @BUILD_CC@ BUILD_CFLAGS = -g -O2 BUILD_CPPFLAGS = -I. -Iinclude -I$(srcdir)/include -Wall -W \ - -DPUPA_DATADIR=\"$(pkgdatadir)\" + -DGRUB_DATADIR=\"$(pkgdatadir)\" OBJCOPY = @OBJCOPY@ STRIP = @STRIP@ NM = @NM@ @@ -86,14 +86,14 @@ DISK_DISTFILES = $(addprefix disk/i386/pc/,biosdisk.c partition.c) FS_DISTFILES = $(addprefix fs/,fat.c) -INCLUDE_DISTFILES = $(addprefix include/pupa/,boot.h device.h disk.h \ +INCLUDE_DISTFILES = $(addprefix include/grub/,boot.h device.h disk.h \ dl.h elf.h err.h file.h fs.h kernel.h loader.h misc.h mm.h \ net.h rescue.h symbol.h term.h types.h) \ - $(addprefix include/pupa/util/,misc.h resolve.h) \ - include/pupa/i386/types.h \ - $(addprefix include/pupa/i386/pc/,biosdisk.h boot.h \ + $(addprefix include/grub/util/,misc.h resolve.h) \ + include/grub/i386/types.h \ + $(addprefix include/grub/i386/pc/,biosdisk.h boot.h \ console.h init.h kernel.h loader.h memory.h partition.h) \ - $(addprefix include/pupa/i386/pc/util/,biosdisk.h) + $(addprefix include/grub/i386/pc/util/,biosdisk.h) KERN_DISTFILES = $(addprefix kern/,device.c disk.c dl.c err.c file.c \ fs.c loader.c main.c misc.c mm.c rescue.c term.c) \ @@ -105,8 +105,8 @@ LOADER_DISTFILES = $(addprefix loader/i386/pc/,chainloader.c) TERM_DISTFILES = $(addprefix term/i386/pc/,console.c) UTIL_DISTFILES = $(addprefix util/,genmoddep.c misc.c resolve.c) \ - $(addprefix util/i386/pc/,biosdisk.c pupa-mkimage.c \ - pupa-setup.c) + $(addprefix util/i386/pc/,biosdisk.c grub-mkimage.c \ + grub-setup.c) DISTFILES = $(COMMON_DISTFILES) $(BOOT_DISTFILES) $(CONF_DISTFILES) \ $(DISK_DISTFILES) $(FS_DISTFILES) $(INCLUDE_DISTFILES) \ @@ -120,7 +120,7 @@ SCRIPTS = CLEANFILES = MOSTLYCLEANFILES = DISTCLEANFILES = config.status config.cache config.log config.h \ - Makefile stamp-h include/pupa/cpu include/pupa/machine + Makefile stamp-h include/grub/cpu include/grub/machine MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES)) # The default target. diff --git a/NEWS b/NEWS index 1837fdd81..d3f290ca0 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,15 @@ +New in 1.90: + +* Rename the project name PUPA to GRUB. Now this version is the + developmental version of GRUB officially. + +* The GRUB emulator ``grub-emu'' is added. + +* Add support for newworld Mac. This should work with other + PowerPC-based machines as well, if they use IEEE 1275 + (Open Firmware). + + New in 0.7: * Problems in cross-compiling PUPA are fixed. diff --git a/README b/README index 0c29eb4ff..b6543a3b7 100644 --- a/README +++ b/README @@ -21,7 +21,7 @@ use (yet). For now, you can install GRUB 2 into a floppy by these instructions: $ configure && make -$ ./pupa-mkimage -v -d . -o core.img _chain ext2 +$ ./grub-mkimage -v -d . -o core.img _chain ext2 $ dd if=boot.img of=/dev/fd0 bs=512 count=1 $ dd if=core.img of=/dev/fd0 bs=512 seek=1 diff --git a/TODO b/TODO index 3c9a6c849..2d95db053 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,9 @@ -*- Mode: Outline -*- Before working on anything in this file, it's very important that you -make contact with the core PUPA developers. Things herein might be +make contact with the core GRUB developers. Things herein might be slightly out of date or otherwise not easy to understand at first -glance. So write to first. +glance. So write to first. Priorities: Reported bugs generally have top priority. @@ -13,8 +13,6 @@ Priorities: higher priority. -* Replace PUPA with GRUB (or GRUB 2). !!! - * Add more filesystems (such as jfs, ffs, and reiserfs). ! * Add journal playback support to ext2fs (so it will become ext3fs). diff --git a/aclocal.m4 b/aclocal.m4 index a15858a56..0eeae7eb9 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,11 +1,11 @@ -dnl pupa_ASM_USCORE checks if C symbols get an underscore after +dnl grub_ASM_USCORE checks if C symbols get an underscore after dnl compiling to assembler. dnl Written by Pavel Roskin. Based on grub_ASM_EXT_C written by dnl Erich Boleyn and modified by Yoshinori K. Okuji. -AC_DEFUN(pupa_ASM_USCORE, +AC_DEFUN(grub_ASM_USCORE, [AC_REQUIRE([AC_PROG_CC]) AC_MSG_CHECKING([if C symbols get an underscore after compilation]) -AC_CACHE_VAL(pupa_cv_asm_uscore, +AC_CACHE_VAL(grub_cv_asm_uscore, [cat > conftest.c <<\EOF int func (int *list) @@ -22,27 +22,27 @@ else fi if grep _func conftest.s >/dev/null 2>&1; then - pupa_cv_asm_uscore=yes + grub_cv_asm_uscore=yes else - pupa_cv_asm_uscore=no + grub_cv_asm_uscore=no fi rm -f conftest*]) -if test "x$pupa_cv_asm_uscore" = xyes; then - AC_DEFINE_UNQUOTED([HAVE_ASM_USCORE], $pupa_cv_asm_uscore, +if test "x$grub_cv_asm_uscore" = xyes; then + AC_DEFINE_UNQUOTED([HAVE_ASM_USCORE], $grub_cv_asm_uscore, [Define if C symbols get an underscore after compilation]) fi -AC_MSG_RESULT([$pupa_cv_asm_uscore]) +AC_MSG_RESULT([$grub_cv_asm_uscore]) ]) dnl Some versions of `objcopy -O binary' vary their output depending dnl on the link address. -AC_DEFUN(pupa_PROG_OBJCOPY_ABSOLUTE, +AC_DEFUN(grub_PROG_OBJCOPY_ABSOLUTE, [AC_MSG_CHECKING([whether ${OBJCOPY} works for absolute addresses]) -AC_CACHE_VAL(pupa_cv_prog_objcopy_absolute, +AC_CACHE_VAL(grub_cv_prog_objcopy_absolute, [cat > conftest.c <<\EOF void cmain (void) @@ -55,7 +55,7 @@ if AC_TRY_EVAL(ac_compile) && test -s conftest.o; then : else AC_MSG_ERROR([${CC-cc} cannot compile C source code]) fi -pupa_cv_prog_objcopy_absolute=yes +grub_cv_prog_objcopy_absolute=yes for link_addr in 2000 8000 7C00; do if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then : else @@ -68,15 +68,15 @@ for link_addr in 2000 8000 7C00; do if test ! -f conftest.old || AC_TRY_COMMAND([cmp -s conftest.old conftest]); then mv -f conftest conftest.old else - pupa_cv_prog_objcopy_absolute=no + grub_cv_prog_objcopy_absolute=no break fi done rm -f conftest*]) -AC_MSG_RESULT([$pupa_cv_prog_objcopy_absolute]) +AC_MSG_RESULT([$grub_cv_prog_objcopy_absolute]) -if test "x$pupa_cv_prog_objcopy_absolute" = xno; then - AC_MSG_ERROR([PUPA requires a working absolute objcopy; upgrade your binutils]) +if test "x$grub_cv_prog_objcopy_absolute" = xno; then + AC_MSG_ERROR([GRUB requires a working absolute objcopy; upgrade your binutils]) fi ]) @@ -94,77 +94,77 @@ dnl dnl We only support the newer versions, because the old versions cause dnl major pain, by requiring manual assembly to get 16-bit instructions into dnl asm files. -AC_DEFUN(pupa_I386_ASM_ADDR32, +AC_DEFUN(grub_I386_ASM_ADDR32, [AC_REQUIRE([AC_PROG_CC]) -AC_REQUIRE([pupa_I386_ASM_PREFIX_REQUIREMENT]) +AC_REQUIRE([grub_I386_ASM_PREFIX_REQUIREMENT]) AC_MSG_CHECKING([for .code16 addr32 assembler support]) -AC_CACHE_VAL(pupa_cv_i386_asm_addr32, +AC_CACHE_VAL(grub_cv_i386_asm_addr32, [cat > conftest.s.in <<\EOF .code16 l1: @ADDR32@ movb %al, l1 EOF -if test "x$pupa_cv_i386_asm_prefix_requirement" = xyes; then +if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then sed -e s/@ADDR32@/addr32/ < conftest.s.in > conftest.s else sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s fi if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then - pupa_cv_i386_asm_addr32=yes + grub_cv_i386_asm_addr32=yes else - pupa_cv_i386_asm_addr32=no + grub_cv_i386_asm_addr32=no fi rm -f conftest*]) -AC_MSG_RESULT([$pupa_cv_i386_asm_addr32])]) +AC_MSG_RESULT([$grub_cv_i386_asm_addr32])]) dnl Later versions of GAS requires that addr32 and data32 prefixes dnl appear in the same lines as the instructions they modify, while dnl earlier versions requires that they appear in separate lines. -AC_DEFUN(pupa_I386_ASM_PREFIX_REQUIREMENT, +AC_DEFUN(grub_I386_ASM_PREFIX_REQUIREMENT, [AC_REQUIRE([AC_PROG_CC]) AC_MSG_CHECKING(dnl [whether addr32 must be in the same line as the instruction]) -AC_CACHE_VAL(pupa_cv_i386_asm_prefix_requirement, +AC_CACHE_VAL(grub_cv_i386_asm_prefix_requirement, [cat > conftest.s <<\EOF .code16 l1: addr32 movb %al, l1 EOF if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then - pupa_cv_i386_asm_prefix_requirement=yes + grub_cv_i386_asm_prefix_requirement=yes else - pupa_cv_i386_asm_prefix_requirement=no + grub_cv_i386_asm_prefix_requirement=no fi rm -f conftest*]) -if test "x$pupa_cv_i386_asm_prefix_requirement" = xyes; then - pupa_tmp_addr32="addr32" - pupa_tmp_data32="data32" +if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then + grub_tmp_addr32="addr32" + grub_tmp_data32="data32" else - pupa_tmp_addr32="addr32;" - pupa_tmp_data32="data32;" + grub_tmp_addr32="addr32;" + grub_tmp_data32="data32;" fi -AC_DEFINE_UNQUOTED([ADDR32], $pupa_tmp_addr32, +AC_DEFINE_UNQUOTED([ADDR32], $grub_tmp_addr32, [Define it to \"addr32\" or \"addr32;\" to make GAS happy]) -AC_DEFINE_UNQUOTED([DATA32], $pupa_tmp_data32, +AC_DEFINE_UNQUOTED([DATA32], $grub_tmp_data32, [Define it to \"data32\" or \"data32;\" to make GAS happy]) -AC_MSG_RESULT([$pupa_cv_i386_asm_prefix_requirement])]) +AC_MSG_RESULT([$grub_cv_i386_asm_prefix_requirement])]) dnl Older versions of GAS require that absolute indirect calls/jumps are dnl not prefixed with `*', while later versions warn if not prefixed. -AC_DEFUN(pupa_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK, +AC_DEFUN(grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK, [AC_REQUIRE([AC_PROG_CC]) AC_MSG_CHECKING(dnl [whether an absolute indirect call/jump must not be prefixed with an asterisk]) -AC_CACHE_VAL(pupa_cv_i386_asm_absolute_without_asterisk, +AC_CACHE_VAL(grub_cv_i386_asm_absolute_without_asterisk, [cat > conftest.s <<\EOF lcall *(offset) offset: @@ -173,46 +173,46 @@ offset: EOF if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then - pupa_cv_i386_asm_absolute_without_asterisk=no + grub_cv_i386_asm_absolute_without_asterisk=no else - pupa_cv_i386_asm_absolute_without_asterisk=yes + grub_cv_i386_asm_absolute_without_asterisk=yes fi rm -f conftest*]) -if test "x$pupa_cv_i386_asm_absolute_without_asterisk" = xyes; then +if test "x$grub_cv_i386_asm_absolute_without_asterisk" = xyes; then AC_DEFINE([ABSOLUTE_WITHOUT_ASTERISK], 1, [Define it if GAS requires that absolute indirect calls/jumps are not prefixed with an asterisk]) fi -AC_MSG_RESULT([$pupa_cv_i386_asm_absolute_without_asterisk])]) +AC_MSG_RESULT([$grub_cv_i386_asm_absolute_without_asterisk])]) dnl Check what symbol is defined as a start symbol. dnl Written by Yoshinori K. Okuji. -AC_DEFUN(pupa_CHECK_START_SYMBOL, +AC_DEFUN(grub_CHECK_START_SYMBOL, [AC_REQUIRE([AC_PROG_CC]) AC_MSG_CHECKING([if start is defined by the compiler]) -AC_CACHE_VAL(pupa_cv_check_start_symbol, +AC_CACHE_VAL(grub_cv_check_start_symbol, [AC_TRY_LINK([], [asm ("incl start")], - pupa_cv_check_start_symbol=yes, - pupa_cv_check_start_symbol=no)]) + grub_cv_check_start_symbol=yes, + grub_cv_check_start_symbol=no)]) -AC_MSG_RESULT([$pupa_cv_check_start_symbol]) +AC_MSG_RESULT([$grub_cv_check_start_symbol]) AC_MSG_CHECKING([if _start is defined by the compiler]) -AC_CACHE_VAL(pupa_cv_check_uscore_start_symbol, +AC_CACHE_VAL(grub_cv_check_uscore_start_symbol, [AC_TRY_LINK([], [asm ("incl _start")], - pupa_cv_check_uscore_start_symbol=yes, - pupa_cv_check_uscore_start_symbol=no)]) + grub_cv_check_uscore_start_symbol=yes, + grub_cv_check_uscore_start_symbol=no)]) -AC_MSG_RESULT([$pupa_cv_check_uscore_start_symbol]) +AC_MSG_RESULT([$grub_cv_check_uscore_start_symbol]) AH_TEMPLATE([START_SYMBOL], [Define it to either start or _start]) -if test "x$pupa_cv_check_start_symbol" = xyes; then +if test "x$grub_cv_check_start_symbol" = xyes; then AC_DEFINE([START_SYMBOL], [start]) -elif test "x$pupa_cv_check_uscore_start_symbol" = xyes; then +elif test "x$grub_cv_check_uscore_start_symbol" = xyes; then AC_DEFINE([START_SYMBOL], [_start]) else AC_MSG_ERROR([neither start nor _start is defined]) @@ -221,39 +221,39 @@ fi dnl Check what symbol is defined as a bss start symbol. dnl Written by Michael Hohmoth and Yoshinori K. Okuji. -AC_DEFUN(pupa_CHECK_BSS_START_SYMBOL, +AC_DEFUN(grub_CHECK_BSS_START_SYMBOL, [AC_REQUIRE([AC_PROG_CC]) AC_MSG_CHECKING([if __bss_start is defined by the compiler]) -AC_CACHE_VAL(pupa_cv_check_uscore_uscore_bss_start_symbol, +AC_CACHE_VAL(grub_cv_check_uscore_uscore_bss_start_symbol, [AC_TRY_LINK([], [asm ("incl __bss_start")], - pupa_cv_check_uscore_uscore_bss_start_symbol=yes, - pupa_cv_check_uscore_uscore_bss_start_symbol=no)]) + grub_cv_check_uscore_uscore_bss_start_symbol=yes, + grub_cv_check_uscore_uscore_bss_start_symbol=no)]) -AC_MSG_RESULT([$pupa_cv_check_uscore_uscore_bss_start_symbol]) +AC_MSG_RESULT([$grub_cv_check_uscore_uscore_bss_start_symbol]) AC_MSG_CHECKING([if edata is defined by the compiler]) -AC_CACHE_VAL(pupa_cv_check_edata_symbol, +AC_CACHE_VAL(grub_cv_check_edata_symbol, [AC_TRY_LINK([], [asm ("incl edata")], - pupa_cv_check_edata_symbol=yes, - pupa_cv_check_edata_symbol=no)]) + grub_cv_check_edata_symbol=yes, + grub_cv_check_edata_symbol=no)]) -AC_MSG_RESULT([$pupa_cv_check_edata_symbol]) +AC_MSG_RESULT([$grub_cv_check_edata_symbol]) AC_MSG_CHECKING([if _edata is defined by the compiler]) -AC_CACHE_VAL(pupa_cv_check_uscore_edata_symbol, +AC_CACHE_VAL(grub_cv_check_uscore_edata_symbol, [AC_TRY_LINK([], [asm ("incl _edata")], - pupa_cv_check_uscore_edata_symbol=yes, - pupa_cv_check_uscore_edata_symbol=no)]) + grub_cv_check_uscore_edata_symbol=yes, + grub_cv_check_uscore_edata_symbol=no)]) -AC_MSG_RESULT([$pupa_cv_check_uscore_edata_symbol]) +AC_MSG_RESULT([$grub_cv_check_uscore_edata_symbol]) AH_TEMPLATE([BSS_START_SYMBOL], [Define it to one of __bss_start, edata and _edata]) -if test "x$pupa_cv_check_uscore_uscore_bss_start_symbol" = xyes; then +if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" = xyes; then AC_DEFINE([BSS_START_SYMBOL], [__bss_start]) -elif test "x$pupa_cv_check_edata_symbol" = xyes; then +elif test "x$grub_cv_check_edata_symbol" = xyes; then AC_DEFINE([BSS_START_SYMBOL], [edata]) -elif test "x$pupa_cv_check_uscore_edata_symbol" = xyes; then +elif test "x$grub_cv_check_uscore_edata_symbol" = xyes; then AC_DEFINE([BSS_START_SYMBOL], [_edata]) else AC_MSG_ERROR([none of __bss_start, edata or _edata is defined]) @@ -262,29 +262,29 @@ fi dnl Check what symbol is defined as an end symbol. dnl Written by Yoshinori K. Okuji. -AC_DEFUN(pupa_CHECK_END_SYMBOL, +AC_DEFUN(grub_CHECK_END_SYMBOL, [AC_REQUIRE([AC_PROG_CC]) AC_MSG_CHECKING([if end is defined by the compiler]) -AC_CACHE_VAL(pupa_cv_check_end_symbol, +AC_CACHE_VAL(grub_cv_check_end_symbol, [AC_TRY_LINK([], [asm ("incl end")], - pupa_cv_check_end_symbol=yes, - pupa_cv_check_end_symbol=no)]) + grub_cv_check_end_symbol=yes, + grub_cv_check_end_symbol=no)]) -AC_MSG_RESULT([$pupa_cv_check_end_symbol]) +AC_MSG_RESULT([$grub_cv_check_end_symbol]) AC_MSG_CHECKING([if _end is defined by the compiler]) -AC_CACHE_VAL(pupa_cv_check_uscore_end_symbol, +AC_CACHE_VAL(grub_cv_check_uscore_end_symbol, [AC_TRY_LINK([], [asm ("incl _end")], - pupa_cv_check_uscore_end_symbol=yes, - pupa_cv_check_uscore_end_symbol=no)]) + grub_cv_check_uscore_end_symbol=yes, + grub_cv_check_uscore_end_symbol=no)]) -AC_MSG_RESULT([$pupa_cv_check_uscore_end_symbol]) +AC_MSG_RESULT([$grub_cv_check_uscore_end_symbol]) AH_TEMPLATE([END_SYMBOL], [Define it to either end or _end]) -if test "x$pupa_cv_check_end_symbol" = xyes; then +if test "x$grub_cv_check_end_symbol" = xyes; then AC_DEFINE([END_SYMBOL], [end]) -elif test "x$pupa_cv_check_uscore_end_symbol" = xyes; then +elif test "x$grub_cv_check_uscore_end_symbol" = xyes; then AC_DEFINE([END_SYMBOL], [_end]) else AC_MSG_ERROR([neither end nor _end is defined]) @@ -295,10 +295,10 @@ dnl Check if the C compiler has a bug while using nested functions when dnl mregparm is used on the i386. Some gcc versions do not pass the third dnl parameter correctly to the nested function. dnl Written by Marco Gerards. -AC_DEFUN(pupa_I386_CHECK_REGPARM_BUG, +AC_DEFUN(grub_I386_CHECK_REGPARM_BUG, [AC_REQUIRE([AC_PROG_CC]) AC_MSG_CHECKING([if GCC has the regparm=3 bug]) -AC_CACHE_VAL(pupa_cv_i386_check_nested_functions, +AC_CACHE_VAL(grub_cv_i386_check_nested_functions, [AC_RUN_IFELSE([AC_LANG_SOURCE( [[int *p; @@ -316,12 +316,12 @@ main () return nestedfunc (0, 0, 0); } ]])], - [pupa_cv_i386_check_nested_functions=yes], - [pupa_cv_i386_check_nested_functions=no])]) + [grub_cv_i386_check_nested_functions=yes], + [grub_cv_i386_check_nested_functions=no])]) -AC_MSG_RESULT([$pupa_cv_i386_check_nested_functions]) +AC_MSG_RESULT([$grub_cv_i386_check_nested_functions]) -if test "x$pupa_cv_i386_check_nested_functions" = xyes; then +if test "x$grub_cv_i386_check_nested_functions" = xyes; then AC_DEFINE([NESTED_FUNC_ATTR], [__attribute__ ((__regparm__ (2)))], [Catch gcc bug]) diff --git a/boot/i386/pc/boot.S b/boot/i386/pc/boot.S index e4e0543c6..2e2aaf514 100644 --- a/boot/i386/pc/boot.S +++ b/boot/i386/pc/boot.S @@ -1,6 +1,6 @@ /* -*-Asm-*- */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,8 +18,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include +#include +#include /* * defines for the code go here @@ -83,25 +83,25 @@ cylinder_start: .word 0 /* more space... */ - . = _start + PUPA_BOOT_MACHINE_BPB_END + . = _start + GRUB_BOOT_MACHINE_BPB_END /* * End of BIOS parameter block. */ boot_version: - .byte PUPA_BOOT_VERSION_MAJOR, PUPA_BOOT_VERSION_MINOR + .byte GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR boot_drive: .byte 0xff /* the disk to load kernel from */ /* 0xff means use the boot drive */ force_lba: .byte 0 kernel_address: - .word PUPA_BOOT_MACHINE_KERNEL_ADDR + .word GRUB_BOOT_MACHINE_KERNEL_ADDR kernel_sector: .long 1 kernel_segment: - .word PUPA_BOOT_MACHINE_KERNEL_SEG + .word GRUB_BOOT_MACHINE_KERNEL_SEG after_BPB: @@ -122,7 +122,7 @@ real_start: movw %ax, %ss /* set up the REAL stack */ - movw $PUPA_BOOT_MACHINE_STACK_SEG, %sp + movw $GRUB_BOOT_MACHINE_STACK_SEG, %sp sti /* we're safe again */ @@ -141,7 +141,7 @@ real_start: MSG(notification_string) /* do not probe LBA if the drive is a floppy */ - testb $PUPA_BOOT_MACHINE_BIOS_HD_FLAG, %dl + testb $GRUB_BOOT_MACHINE_BIOS_HD_FLAG, %dl jz chs_mode /* check if LBA is supported */ @@ -190,7 +190,7 @@ lba_mode: movl %ebx, 8(%si) /* the segment of buffer address */ - movw $PUPA_BOOT_MACHINE_BUFFER_SEG, 6(%si) + movw $GRUB_BOOT_MACHINE_BUFFER_SEG, 6(%si) xorl %eax, %eax movw %ax, 4(%si) @@ -211,7 +211,7 @@ lba_mode: /* LBA read is not supported, so fallback to CHS. */ jc chs_mode - movw $PUPA_BOOT_MACHINE_BUFFER_SEG, %bx + movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx jmp copy_buffer chs_mode: @@ -226,7 +226,7 @@ chs_mode: /* * The call failed, so maybe use the floppy probe instead. */ - testb $PUPA_BOOT_MACHINE_BIOS_HD_FLAG, %dl + testb $GRUB_BOOT_MACHINE_BIOS_HD_FLAG, %dl jz floppy_probe /* Nope, we definitely have a hard disk, and we're screwed. */ @@ -322,7 +322,7 @@ setup_sectors: * %al = 0x0 on success; err code on failure */ - movw $PUPA_BOOT_MACHINE_BUFFER_SEG, %bx + movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx movw %bx, %es /* load %es segment with disk buffer */ xorw %bx, %bx /* %bx = 0, put it at 0 in the segment */ @@ -387,7 +387,7 @@ general_error: /* go here when you need to stop the machine hard after an error condition */ stop: jmp stop -notification_string: .string "PUPA " +notification_string: .string "GRUB " geometry_error_string: .string "Geom" hd_probe_error_string: .string "Hard Disk" read_error_string: .string "Read" @@ -419,7 +419,7 @@ message: * number here. */ - . = _start + PUPA_BOOT_MACHINE_WINDOWS_NT_MAGIC + . = _start + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC nt_magic: .long 0 .word 0 @@ -431,7 +431,7 @@ nt_magic: */ part_start: - . = _start + PUPA_BOOT_MACHINE_PART_START + . = _start + GRUB_BOOT_MACHINE_PART_START probe_values: .byte 36, 18, 15, 9, 0 @@ -465,7 +465,7 @@ fd_probe_error_string: .string "Floppy" 1: /* perform read */ - movw $PUPA_BOOT_MACHINE_BUFFER_SEG, %bx + movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx movw $0x201, %ax movb $0, %ch movb $0, %dh @@ -480,7 +480,7 @@ fd_probe_error_string: .string "Floppy" jmp final_init - . = _start + PUPA_BOOT_MACHINE_PART_END + . = _start + GRUB_BOOT_MACHINE_PART_END /* the last 2 bytes in the sector 0 contain the signature */ - .word PUPA_BOOT_MACHINE_SIGNATURE + .word GRUB_BOOT_MACHINE_SIGNATURE diff --git a/boot/i386/pc/diskboot.S b/boot/i386/pc/diskboot.S index 72c4f028f..c2a0e0ccd 100644 --- a/boot/i386/pc/diskboot.S +++ b/boot/i386/pc/diskboot.S @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include +#include /* * defines for the code go here @@ -26,7 +26,7 @@ /* Absolute addresses This makes the assembler generate the address without support from the linker. (ELF can't relocate 16-bit addresses!) */ -#define ABS(x) (x-_start+PUPA_BOOT_MACHINE_KERNEL_ADDR) +#define ABS(x) (x-_start+GRUB_BOOT_MACHINE_KERNEL_ADDR) /* Print message string */ #define MSG(x) movw $ABS(x), %si; call message @@ -62,7 +62,7 @@ _start: popw %si /* this sets up for the first run through "bootloop" */ - movw $ABS(firstlist - PUPA_BOOT_MACHINE_LIST_SIZE), %di + movw $ABS(firstlist - GRUB_BOOT_MACHINE_LIST_SIZE), %di /* save the sector number of the second sector in %ebp */ movl (%di), %ebp @@ -119,7 +119,7 @@ lba_mode: movl %ebx, 8(%si) /* the segment of buffer address */ - movw $PUPA_BOOT_MACHINE_BUFFER_SEG, 6(%si) + movw $GRUB_BOOT_MACHINE_BUFFER_SEG, 6(%si) /* save %ax from destruction! */ pushw %ax @@ -148,7 +148,7 @@ lba_mode: jc read_error - movw $PUPA_BOOT_MACHINE_BUFFER_SEG, %bx + movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx jmp copy_buffer chs_mode: @@ -237,7 +237,7 @@ chs_mode: * %al = 0x0 on success; err code on failure */ - movw $PUPA_BOOT_MACHINE_BUFFER_SEG, %bx + movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx movw %bx, %es /* load %es segment with disk buffer */ xorw %bx, %bx /* %bx = 0, put it at 0 in the segment */ @@ -292,7 +292,7 @@ copy_buffer: jne setup_sectors /* update position to load from */ - subw $PUPA_BOOT_MACHINE_LIST_SIZE, %di + subw $GRUB_BOOT_MACHINE_LIST_SIZE, %di /* jump to bootloop */ jmp bootloop @@ -303,7 +303,7 @@ bootit: /* print a newline */ MSG(notification_done) popw %dx /* this makes sure %dl is our "boot" drive */ - ljmp $0, $(PUPA_BOOT_MACHINE_KERNEL_ADDR + 0x200) + ljmp $0, $(GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200) /* @@ -368,7 +368,7 @@ lastlist: .word 0 .word 0 - . = _start + 0x200 - PUPA_BOOT_MACHINE_LIST_SIZE + . = _start + 0x200 - GRUB_BOOT_MACHINE_LIST_SIZE /* fill the first data listing with the default */ blocklist_default_start: @@ -381,6 +381,6 @@ blocklist_default_len: .word 0 blocklist_default_seg: /* this is the segment of the starting address to load the data into */ - .word (PUPA_BOOT_MACHINE_KERNEL_SEG + 0x20) + .word (GRUB_BOOT_MACHINE_KERNEL_SEG + 0x20) firstlist: /* this label has to be after the list data!!! */ diff --git a/boot/powerpc/ieee1275/cmain.c b/boot/powerpc/ieee1275/cmain.c index 7682a2959..b24504261 100644 --- a/boot/powerpc/ieee1275/cmain.c +++ b/boot/powerpc/ieee1275/cmain.c @@ -1,6 +1,6 @@ /* cmain.c - Startup code for the PowerPC. */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003, 2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -21,8 +21,8 @@ #include #include -#include "pupa/machine/ieee1275.h" -#include "pupa/kernel.h" +#include "grub/machine/ieee1275.h" +#include "grub/kernel.h" struct module_info { @@ -33,7 +33,7 @@ struct module_info #define roundup(a, s) (((a) + ((s) - 1)) & ~((s) - 1)) /* OpenFirmware entry point passed to us from the real bootloader. */ -intptr_t (*pupa_ieee1275_entry_fn) (void *); +intptr_t (*grub_ieee1275_entry_fn) (void *); /* Return a help text for this architecture. */ @@ -51,11 +51,11 @@ void cmain (uint32_t firmware_entry) { char **argv, args[256]; - pupa_ieee1275_phandle_t chosen; + grub_ieee1275_phandle_t chosen; int argc = 0, actual; long batl, batu; - pupa_ieee1275_entry_fn = (intptr_t (*)(void *)) firmware_entry; + grub_ieee1275_entry_fn = (intptr_t (*)(void *)) firmware_entry; /* Initialize BAT registers to unmapped to not generate overlapping mappings below. */ @@ -83,8 +83,8 @@ cmain (uint32_t firmware_entry) be null (just the nul-character), so check that the size is actually greater than one. */ - pupa_ieee1275_finddevice ("/chosen", &chosen); - if (pupa_ieee1275_get_property (chosen, "bootargs", args, + grub_ieee1275_finddevice ("/chosen", &chosen); + if (grub_ieee1275_get_property (chosen, "bootargs", args, sizeof args, &actual) == 0 && actual > 1) { @@ -109,7 +109,7 @@ cmain (uint32_t firmware_entry) /* The bootargs property does not contain the program name, just the arguments. */ - argv[0] = "pupa"; + argv[0] = "grub"; /* Second time around we fill in the argv. */ str = args; @@ -136,13 +136,13 @@ cmain (uint32_t firmware_entry) else { argv = alloca (sizeof (char *) * 2); - argv[0] = "pupa"; + argv[0] = "grub"; argv[1] = 0; argc = 1; } /* Now invoke the main function. */ - /* XXX: pupa_main does not parse arguments yet. */ - pupa_main (); + /* XXX: grub_main does not parse arguments yet. */ + grub_main (); /* Never reached. */ } diff --git a/boot/powerpc/ieee1275/crt0.S b/boot/powerpc/ieee1275/crt0.S index 04a9cf5c4..168999b72 100644 --- a/boot/powerpc/ieee1275/crt0.S +++ b/boot/powerpc/ieee1275/crt0.S @@ -1,6 +1,6 @@ /* crt0.S - Startup code for the PowerPC. */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003, 2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify diff --git a/boot/powerpc/ieee1275/ieee1275.c b/boot/powerpc/ieee1275/ieee1275.c index 7f1e5edb3..09839616c 100644 --- a/boot/powerpc/ieee1275/ieee1275.c +++ b/boot/powerpc/ieee1275/ieee1275.c @@ -1,6 +1,6 @@ /* ieee1275.c - Access the Open Firmware client interface. */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003, 2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,16 +18,16 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include +#include -#define IEEE1275_PHANDLE_ROOT ((pupa_ieee1275_phandle_t) 0) -#define IEEE1275_PHANDLE_INVALID ((pupa_ieee1275_phandle_t) -1) +#define IEEE1275_PHANDLE_ROOT ((grub_ieee1275_phandle_t) 0) +#define IEEE1275_PHANDLE_INVALID ((grub_ieee1275_phandle_t) -1) -intptr_t (*pupa_ieee1275_entry_fn) (void *); +intptr_t (*grub_ieee1275_entry_fn) (void *); #ifndef IEEE1275_CALL_ENTRY_FN -#define IEEE1275_CALL_ENTRY_FN(args) (*pupa_ieee1275_entry_fn) (args) +#define IEEE1275_CALL_ENTRY_FN(args) (*grub_ieee1275_entry_fn) (args) #endif /* All backcalls to the firmware is done by calling an entry function @@ -35,7 +35,7 @@ intptr_t (*pupa_ieee1275_entry_fn) (void *); a structure is passed which specifies what the firmware should do. NAME is the requested service. NR_INS and NR_OUTS is the number of passed arguments and the expected number of return values, resp. */ -struct pupa_ieee1275_common_hdr +struct grub_ieee1275_common_hdr { char *name; int nr_ins; @@ -46,10 +46,10 @@ struct pupa_ieee1275_common_hdr (p)->name = xname; (p)->nr_ins = xins; (p)->nr_outs = xouts /* FIXME is this function needed? */ -pupa_uint32_t -pupa_ieee1275_decode_int_4 (unsigned char *p) +grub_uint32_t +grub_ieee1275_decode_int_4 (unsigned char *p) { - pupa_uint32_t val = (*p++ << 8); + grub_uint32_t val = (*p++ << 8); val = (val + *p++) << 8; val = (val + *p++) << 8; return (val + *p); @@ -57,12 +57,12 @@ pupa_ieee1275_decode_int_4 (unsigned char *p) int -pupa_ieee1275_finddevice (char *name, pupa_ieee1275_phandle_t *phandlep) +grub_ieee1275_finddevice (char *name, grub_ieee1275_phandle_t *phandlep) { struct find_device_args { - struct pupa_ieee1275_common_hdr common; + struct grub_ieee1275_common_hdr common; char *device; - pupa_ieee1275_phandle_t phandle; + grub_ieee1275_phandle_t phandle; } args; INIT_IEEE1275_COMMON (&args.common, "finddevice", 1, 1); @@ -75,12 +75,12 @@ pupa_ieee1275_finddevice (char *name, pupa_ieee1275_phandle_t *phandlep) } int -pupa_ieee1275_get_property (int handle, const char *property, void *buf, - pupa_size_t size, pupa_size_t *actual) +grub_ieee1275_get_property (int handle, const char *property, void *buf, + grub_size_t size, grub_size_t *actual) { struct get_property_args { - struct pupa_ieee1275_common_hdr common; - pupa_ieee1275_phandle_t phandle; + struct grub_ieee1275_common_hdr common; + grub_ieee1275_phandle_t phandle; const char *prop; void *buf; int buflen; @@ -101,12 +101,12 @@ pupa_ieee1275_get_property (int handle, const char *property, void *buf, } int -pupa_ieee1275_next_property (int handle, char *prev_prop, char *prop, +grub_ieee1275_next_property (int handle, char *prev_prop, char *prop, int *flags) { struct get_property_args { - struct pupa_ieee1275_common_hdr common; - pupa_ieee1275_phandle_t phandle; + struct grub_ieee1275_common_hdr common; + grub_ieee1275_phandle_t phandle; char *prev_prop; char *next_prop; int flags; @@ -126,14 +126,14 @@ pupa_ieee1275_next_property (int handle, char *prev_prop, char *prop, } int -pupa_ieee1275_get_property_length (pupa_ieee1275_phandle_t handle, - const char *prop, pupa_size_t *length) +grub_ieee1275_get_property_length (grub_ieee1275_phandle_t handle, + const char *prop, grub_size_t *length) { struct get_property_args { - struct pupa_ieee1275_common_hdr common; - pupa_ieee1275_phandle_t phandle; + struct grub_ieee1275_common_hdr common; + grub_ieee1275_phandle_t phandle; const char *prop; - pupa_size_t length; + grub_size_t length; } args; INIT_IEEE1275_COMMON (&args.common, "getproplen", 2, 1); @@ -148,13 +148,13 @@ pupa_ieee1275_get_property_length (pupa_ieee1275_phandle_t handle, } int -pupa_ieee1275_instance_to_package (pupa_ieee1275_ihandle_t ihandle, - pupa_ieee1275_phandle_t *phandlep) +grub_ieee1275_instance_to_package (grub_ieee1275_ihandle_t ihandle, + grub_ieee1275_phandle_t *phandlep) { struct instance_to_package_args { - struct pupa_ieee1275_common_hdr common; - pupa_ieee1275_ihandle_t ihandle; - pupa_ieee1275_phandle_t phandle; + struct grub_ieee1275_common_hdr common; + grub_ieee1275_ihandle_t ihandle; + grub_ieee1275_phandle_t phandle; } args; INIT_IEEE1275_COMMON (&args.common, "instance-to-package", 1, 1); @@ -167,12 +167,12 @@ pupa_ieee1275_instance_to_package (pupa_ieee1275_ihandle_t ihandle, } int -pupa_ieee1275_package_to_path (pupa_ieee1275_phandle_t phandle, - char *path, pupa_size_t len, pupa_size_t *actual) +grub_ieee1275_package_to_path (grub_ieee1275_phandle_t phandle, + char *path, grub_size_t len, grub_size_t *actual) { struct instance_to_package_args { - struct pupa_ieee1275_common_hdr common; - pupa_ieee1275_phandle_t phandle; + struct grub_ieee1275_common_hdr common; + grub_ieee1275_phandle_t phandle; char *buf; int buflen; int actual; @@ -191,13 +191,13 @@ pupa_ieee1275_package_to_path (pupa_ieee1275_phandle_t phandle, } int -pupa_ieee1275_instance_to_path (pupa_ieee1275_ihandle_t ihandle, - char *path, pupa_size_t len, - pupa_size_t *actual) +grub_ieee1275_instance_to_path (grub_ieee1275_ihandle_t ihandle, + char *path, grub_size_t len, + grub_size_t *actual) { struct instance_to_package_args { - struct pupa_ieee1275_common_hdr common; - pupa_ieee1275_ihandle_t ihandle; + struct grub_ieee1275_common_hdr common; + grub_ieee1275_ihandle_t ihandle; char *buf; int buflen; int actual; @@ -216,15 +216,15 @@ pupa_ieee1275_instance_to_path (pupa_ieee1275_ihandle_t ihandle, } int -pupa_ieee1275_write (pupa_ieee1275_ihandle_t ihandle, void *buffer, - pupa_size_t len, pupa_size_t *actualp) +grub_ieee1275_write (grub_ieee1275_ihandle_t ihandle, void *buffer, + grub_size_t len, grub_size_t *actualp) { struct write_args { - struct pupa_ieee1275_common_hdr common; - pupa_ieee1275_ihandle_t ihandle; + struct grub_ieee1275_common_hdr common; + grub_ieee1275_ihandle_t ihandle; void *buf; - pupa_size_t len; - pupa_size_t actual; + grub_size_t len; + grub_size_t actual; } args; INIT_IEEE1275_COMMON (&args.common, "write", 3, 1); @@ -240,15 +240,15 @@ pupa_ieee1275_write (pupa_ieee1275_ihandle_t ihandle, void *buffer, } int -pupa_ieee1275_read (pupa_ieee1275_ihandle_t ihandle, void *buffer, - pupa_size_t len, pupa_size_t *actualp) +grub_ieee1275_read (grub_ieee1275_ihandle_t ihandle, void *buffer, + grub_size_t len, grub_size_t *actualp) { struct write_args { - struct pupa_ieee1275_common_hdr common; - pupa_ieee1275_ihandle_t ihandle; + struct grub_ieee1275_common_hdr common; + grub_ieee1275_ihandle_t ihandle; void *buf; - pupa_size_t len; - pupa_size_t actual; + grub_size_t len; + grub_size_t actual; } args; INIT_IEEE1275_COMMON (&args.common, "read", 3, 1); @@ -264,12 +264,12 @@ pupa_ieee1275_read (pupa_ieee1275_ihandle_t ihandle, void *buffer, } int -pupa_ieee1275_seek (pupa_ieee1275_ihandle_t ihandle, int pos_hi, +grub_ieee1275_seek (grub_ieee1275_ihandle_t ihandle, int pos_hi, int pos_lo, int *result) { struct write_args { - struct pupa_ieee1275_common_hdr common; - pupa_ieee1275_ihandle_t ihandle; + struct grub_ieee1275_common_hdr common; + grub_ieee1275_ihandle_t ihandle; int pos_hi; int pos_lo; int result; @@ -289,13 +289,13 @@ pupa_ieee1275_seek (pupa_ieee1275_ihandle_t ihandle, int pos_hi, } int -pupa_ieee1275_peer (pupa_ieee1275_phandle_t node, - pupa_ieee1275_phandle_t *result) +grub_ieee1275_peer (grub_ieee1275_phandle_t node, + grub_ieee1275_phandle_t *result) { struct peer_args { - struct pupa_ieee1275_common_hdr common; - pupa_ieee1275_phandle_t node; - pupa_ieee1275_phandle_t result; + struct grub_ieee1275_common_hdr common; + grub_ieee1275_phandle_t node; + grub_ieee1275_phandle_t result; } args; INIT_IEEE1275_COMMON (&args.common, "peer", 1, 1); @@ -308,13 +308,13 @@ pupa_ieee1275_peer (pupa_ieee1275_phandle_t node, } int -pupa_ieee1275_child (pupa_ieee1275_phandle_t node, - pupa_ieee1275_phandle_t *result) +grub_ieee1275_child (grub_ieee1275_phandle_t node, + grub_ieee1275_phandle_t *result) { struct child_args { - struct pupa_ieee1275_common_hdr common; - pupa_ieee1275_phandle_t node; - pupa_ieee1275_phandle_t result; + struct grub_ieee1275_common_hdr common; + grub_ieee1275_phandle_t node; + grub_ieee1275_phandle_t result; } args; INIT_IEEE1275_COMMON (&args.common, "child", 1, 1); @@ -328,13 +328,13 @@ pupa_ieee1275_child (pupa_ieee1275_phandle_t node, } int -pupa_ieee1275_parent (pupa_ieee1275_phandle_t node, - pupa_ieee1275_phandle_t *result) +grub_ieee1275_parent (grub_ieee1275_phandle_t node, + grub_ieee1275_phandle_t *result) { struct parent_args { - struct pupa_ieee1275_common_hdr common; - pupa_ieee1275_phandle_t node; - pupa_ieee1275_phandle_t result; + struct grub_ieee1275_common_hdr common; + grub_ieee1275_phandle_t node; + grub_ieee1275_phandle_t result; } args; INIT_IEEE1275_COMMON (&args.common, "parent", 1, 1); @@ -348,10 +348,10 @@ pupa_ieee1275_parent (pupa_ieee1275_phandle_t node, } int -pupa_ieee1275_exit (void) +grub_ieee1275_exit (void) { struct exit_args { - struct pupa_ieee1275_common_hdr common; + struct grub_ieee1275_common_hdr common; } args; INIT_IEEE1275_COMMON (&args.common, "exit", 0, 0); @@ -362,12 +362,12 @@ pupa_ieee1275_exit (void) } int -pupa_ieee1275_open (char *node, pupa_ieee1275_ihandle_t *result) +grub_ieee1275_open (char *node, grub_ieee1275_ihandle_t *result) { struct open_args { - struct pupa_ieee1275_common_hdr common; + struct grub_ieee1275_common_hdr common; char *cstr; - pupa_ieee1275_ihandle_t result; + grub_ieee1275_ihandle_t result; } args; INIT_IEEE1275_COMMON (&args.common, "open", 1, 1); @@ -380,11 +380,11 @@ pupa_ieee1275_open (char *node, pupa_ieee1275_ihandle_t *result) } int -pupa_ieee1275_close (pupa_ieee1275_ihandle_t ihandle) +grub_ieee1275_close (grub_ieee1275_ihandle_t ihandle) { struct close_args { - struct pupa_ieee1275_common_hdr common; - pupa_ieee1275_ihandle_t ihandle; + struct grub_ieee1275_common_hdr common; + grub_ieee1275_ihandle_t ihandle; } args; INIT_IEEE1275_COMMON (&args.common, "close", 1, 0); @@ -397,13 +397,13 @@ pupa_ieee1275_close (pupa_ieee1275_ihandle_t ihandle) } int -pupa_ieee1275_claim (void *p, pupa_size_t size, +grub_ieee1275_claim (void *p, grub_size_t size, unsigned int align, void **result) { struct claim_args { - struct pupa_ieee1275_common_hdr common; + struct grub_ieee1275_common_hdr common; void *p; - pupa_size_t size; + grub_size_t size; unsigned int align; void *addr; } args; @@ -420,17 +420,17 @@ pupa_ieee1275_claim (void *p, pupa_size_t size, } int -pupa_ieee1275_set_property (pupa_ieee1275_phandle_t phandle, +grub_ieee1275_set_property (grub_ieee1275_phandle_t phandle, const char *propname, void *buf, - pupa_size_t size, pupa_size_t *actual) + grub_size_t size, grub_size_t *actual) { struct set_property_args { - struct pupa_ieee1275_common_hdr common; - pupa_ieee1275_phandle_t phandle; + struct grub_ieee1275_common_hdr common; + grub_ieee1275_phandle_t phandle; const char *propname; void *buf; - pupa_size_t size; - pupa_size_t actual; + grub_size_t size; + grub_size_t actual; } args; INIT_IEEE1275_COMMON (&args.common, "setprop", 4, 1); @@ -446,13 +446,13 @@ pupa_ieee1275_set_property (pupa_ieee1275_phandle_t phandle, } int -pupa_ieee1275_set_color (pupa_ieee1275_ihandle_t ihandle, +grub_ieee1275_set_color (grub_ieee1275_ihandle_t ihandle, int index, int r, int g, int b) { struct set_color_args { - struct pupa_ieee1275_common_hdr common; + struct grub_ieee1275_common_hdr common; char *method; - pupa_ieee1275_ihandle_t ihandle; + grub_ieee1275_ihandle_t ihandle; int index; int b; int g; diff --git a/commands/boot.c b/commands/boot.c index f9fec1ef7..3bab54668 100644 --- a/commands/boot.c +++ b/commands/boot.c @@ -1,9 +1,9 @@ /* boot.c - command to boot an operating system */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,52 +14,52 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -static pupa_err_t -pupa_cmd_boot (struct pupa_arg_list *state __attribute__ ((unused)), +static grub_err_t +grub_cmd_boot (struct grub_arg_list *state __attribute__ ((unused)), int argc, char **args __attribute__ ((unused))) { if (argc) - return pupa_error (PUPA_ERR_BAD_ARGUMENT, "too many arguments"); + return grub_error (GRUB_ERR_BAD_ARGUMENT, "too many arguments"); - pupa_loader_boot (); + grub_loader_boot (); return 0; } -#ifdef PUPA_UTIL +#ifdef GRUB_UTIL void -pupa_boot_init (void) +grub_boot_init (void) { - pupa_register_command ("boot", pupa_cmd_boot, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("boot", grub_cmd_boot, GRUB_COMMAND_FLAG_BOTH, "boot", "Boot an operating system", 0); } void -pupa_boot_fini (void) +grub_boot_fini (void) { - pupa_unregister_command ("boot"); + grub_unregister_command ("boot"); } -#else /* ! PUPA_UTIL */ -PUPA_MOD_INIT +#else /* ! GRUB_UTIL */ +GRUB_MOD_INIT { (void)mod; /* To stop warning. */ - pupa_register_command ("boot", pupa_cmd_boot, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("boot", grub_cmd_boot, GRUB_COMMAND_FLAG_BOTH, "boot", "Boot an operating system", 0); } -PUPA_MOD_FINI +GRUB_MOD_FINI { - pupa_unregister_command ("boot"); + grub_unregister_command ("boot"); } -#endif /* ! PUPA_UTIL */ +#endif /* ! GRUB_UTIL */ diff --git a/commands/cat.c b/commands/cat.c index cbccd89b4..fb1141fdf 100644 --- a/commands/cat.c +++ b/commands/cat.c @@ -1,9 +1,9 @@ /* cat.c - command to show the contents of a file */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,35 +14,35 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include -static pupa_err_t -pupa_cmd_cat (struct pupa_arg_list *state __attribute__ ((unused)), +static grub_err_t +grub_cmd_cat (struct grub_arg_list *state __attribute__ ((unused)), int argc, char **args) { - pupa_file_t file; - char buf[PUPA_DISK_SECTOR_SIZE]; - pupa_ssize_t size; + grub_file_t file; + char buf[GRUB_DISK_SECTOR_SIZE]; + grub_ssize_t size; if (argc != 1) - return pupa_error (PUPA_ERR_BAD_ARGUMENT, "file name required"); + return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required"); - file = pupa_file_open (args[0]); + file = grub_file_open (args[0]); if (! file) return 0; - while ((size = pupa_file_read (file, buf, sizeof (buf))) > 0) + while ((size = grub_file_read (file, buf, sizeof (buf))) > 0) { int i; @@ -50,48 +50,48 @@ pupa_cmd_cat (struct pupa_arg_list *state __attribute__ ((unused)), { unsigned char c = buf[i]; - if (pupa_isprint (c) || pupa_isspace (c)) - pupa_putchar (c); + if (grub_isprint (c) || grub_isspace (c)) + grub_putchar (c); else { - pupa_setcolorstate (PUPA_TERM_COLOR_HIGHLIGHT); - pupa_printf ("<%x>", (int) c); - pupa_setcolorstate (PUPA_TERM_COLOR_STANDARD); + grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); + grub_printf ("<%x>", (int) c); + grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); } } } - pupa_putchar ('\n'); - pupa_refresh (); - pupa_file_close (file); + grub_putchar ('\n'); + grub_refresh (); + grub_file_close (file); return 0; } -#ifdef PUPA_UTIL +#ifdef GRUB_UTIL void -pupa_cat_init (void) +grub_cat_init (void) { - pupa_register_command ("cat", pupa_cmd_cat, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("cat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH, "cat FILE", "Show the contents of a file", 0); } void -pupa_cat_fini (void) +grub_cat_fini (void) { - pupa_unregister_command ("cat"); + grub_unregister_command ("cat"); } -#else /* ! PUPA_UTIL */ -PUPA_MOD_INIT +#else /* ! GRUB_UTIL */ +GRUB_MOD_INIT { (void)mod; /* To stop warning. */ - pupa_register_command ("cat", pupa_cmd_cat, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("cat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH, "cat FILE", "Show the contents of a file", 0); } -PUPA_MOD_FINI +GRUB_MOD_FINI { - pupa_unregister_command ("cat"); + grub_unregister_command ("cat"); } -#endif /* ! PUPA_UTIL */ +#endif /* ! GRUB_UTIL */ diff --git a/commands/cmp.c b/commands/cmp.c index d5af4772e..237b6f2d0 100644 --- a/commands/cmp.c +++ b/commands/cmp.c @@ -1,9 +1,9 @@ /* cmd.c - command to cmp an operating system */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,57 +14,57 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -static pupa_err_t -pupa_cmd_cmp (struct pupa_arg_list *state __attribute__ ((unused)), +static grub_err_t +grub_cmd_cmp (struct grub_arg_list *state __attribute__ ((unused)), int argc, char **args) { - pupa_file_t file1; - pupa_file_t file2; + grub_file_t file1; + grub_file_t file2; if (argc != 2) - return pupa_error (PUPA_ERR_BAD_ARGUMENT, "two arguments required"); + return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required"); - pupa_printf ("Compare `%s' and `%s':\n", args[0], + grub_printf ("Compare `%s' and `%s':\n", args[0], args[1]); - file1 = pupa_file_open (args[0]); + file1 = grub_file_open (args[0]); if (! file1) - return pupa_errno; + return grub_errno; - file2 = pupa_file_open (args[1]); + file2 = grub_file_open (args[1]); if (! file2) { - pupa_file_close (file2); - return pupa_errno; + grub_file_close (file2); + return grub_errno; } - if (pupa_file_size (file1) != pupa_file_size (file2)) - pupa_printf ("Differ in size: %d [%s], %d [%s]\n", - pupa_file_size (file1), args[0], - pupa_file_size (file2), args[1]); + if (grub_file_size (file1) != grub_file_size (file2)) + grub_printf ("Differ in size: %d [%s], %d [%s]\n", + grub_file_size (file1), args[0], + grub_file_size (file2), args[1]); else { char buf1[512]; char buf2[512]; - pupa_ssize_t rd1, rd2; - pupa_uint32_t pos = 0; + grub_ssize_t rd1, rd2; + grub_uint32_t pos = 0; do { int i; - rd1 = pupa_file_read (file1, buf1, 512); - rd2 = pupa_file_read (file2, buf2, 512); + rd1 = grub_file_read (file1, buf1, 512); + rd2 = grub_file_read (file2, buf2, 512); if (rd1 != rd2) return 0; @@ -73,12 +73,12 @@ pupa_cmd_cmp (struct pupa_arg_list *state __attribute__ ((unused)), { if (buf1[i] != buf2[i]) { - pupa_printf ("Differ at the offset %d: 0x%x [%s], 0x%x [%s]\n", + grub_printf ("Differ at the offset %d: 0x%x [%s], 0x%x [%s]\n", i + pos, buf1[i], args[0], buf2[i], args[1]); - pupa_file_close (file1); - pupa_file_close (file2); + grub_file_close (file1); + grub_file_close (file2); return 0; } } @@ -87,38 +87,38 @@ pupa_cmd_cmp (struct pupa_arg_list *state __attribute__ ((unused)), } while (rd2); } - pupa_file_close (file1); - pupa_file_close (file2); + grub_file_close (file1); + grub_file_close (file2); - pupa_printf ("The files are identical.\n"); + grub_printf ("The files are identical.\n"); return 0; } -#ifdef PUPA_UTIL +#ifdef GRUB_UTIL void -pupa_cmp_init (void) +grub_cmp_init (void) { - pupa_register_command ("cmp", pupa_cmd_cmp, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("cmp", grub_cmd_cmp, GRUB_COMMAND_FLAG_BOTH, "cmp FILE1 FILE2", "Compare two files", 0); } void -pupa_cmp_fini (void) +grub_cmp_fini (void) { - pupa_unregister_command ("cmp"); + grub_unregister_command ("cmp"); } -#else /* ! PUPA_UTIL */ -PUPA_MOD_INIT +#else /* ! GRUB_UTIL */ +GRUB_MOD_INIT { (void)mod; /* To stop warning. */ - pupa_register_command ("cmp", pupa_cmd_cmp, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("cmp", grub_cmd_cmp, GRUB_COMMAND_FLAG_BOTH, "cmp FILE1 FILE2", "Compare two files", 0); } -PUPA_MOD_FINI +GRUB_MOD_FINI { - pupa_unregister_command ("cmp"); + grub_unregister_command ("cmp"); } -#endif /* ! PUPA_UTIL */ +#endif /* ! GRUB_UTIL */ diff --git a/commands/ls.c b/commands/ls.c index cf8b9aa61..04a3f6069 100644 --- a/commands/ls.c +++ b/commands/ls.c @@ -1,9 +1,9 @@ /* ls.c - command to list files and devices */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,24 +14,24 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -static const struct pupa_arg_option options[] = +static const struct grub_arg_option options[] = { {"long", 'l', 0, "Show a long list with more detailed information", 0, 0}, {"human-readable", 'h', 0, "Print sizes in a human readable format", 0, 0}, @@ -39,105 +39,105 @@ static const struct pupa_arg_option options[] = {0, 0, 0, 0, 0, 0} }; -static const char pupa_human_sizes[] = {' ', 'K', 'M', 'G', 'T'}; +static const char grub_human_sizes[] = {' ', 'K', 'M', 'G', 'T'}; -static pupa_err_t -pupa_ls_list_disks (int longlist) +static grub_err_t +grub_ls_list_disks (int longlist) { - auto int pupa_ls_print_disks (const char *name); - int pupa_ls_print_disks (const char *name) + auto int grub_ls_print_disks (const char *name); + int grub_ls_print_disks (const char *name) { - pupa_device_t dev; - auto int print_partition (const pupa_partition_t p); + grub_device_t dev; + auto int print_partition (const grub_partition_t p); - int print_partition (const pupa_partition_t p) + int print_partition (const grub_partition_t p) { - char *pname = pupa_partition_get_name (p); + char *pname = grub_partition_get_name (p); if (pname) { if (longlist) - pupa_print_partinfo (dev, pname); + grub_print_partinfo (dev, pname); else - pupa_printf ("(%s,%s) ", name, pname); + grub_printf ("(%s,%s) ", name, pname); } return 0; } - dev = pupa_device_open (name); - pupa_errno = PUPA_ERR_NONE; + dev = grub_device_open (name); + grub_errno = GRUB_ERR_NONE; if (dev) { if (longlist) - pupa_printf ("Disk: %s\n", name); + grub_printf ("Disk: %s\n", name); else - pupa_printf ("(%s) ", name); + grub_printf ("(%s) ", name); if (dev->disk && dev->disk->has_partitions) { - pupa_partition_iterate (dev->disk, print_partition); - pupa_errno = PUPA_ERR_NONE; + grub_partition_iterate (dev->disk, print_partition); + grub_errno = GRUB_ERR_NONE; } - pupa_device_close (dev); + grub_device_close (dev); } return 0; } - pupa_disk_dev_iterate (pupa_ls_print_disks); - pupa_putchar ('\n'); - pupa_refresh (); + grub_disk_dev_iterate (grub_ls_print_disks); + grub_putchar ('\n'); + grub_refresh (); return 0; } -static pupa_err_t -pupa_ls_list_files (const char *dirname, int longlist, int all, int human) +static grub_err_t +grub_ls_list_files (const char *dirname, int longlist, int all, int human) { char *device_name; - pupa_fs_t fs; + grub_fs_t fs; char *path; - pupa_device_t dev; + grub_device_t dev; static int print_files (const char *filename, int dir) { if (all || filename[0] != '.') - pupa_printf ("%s%s ", filename, dir ? "/" : ""); + grub_printf ("%s%s ", filename, dir ? "/" : ""); return 0; } static int print_files_long (const char *filename, int dir) { - char pathname[pupa_strlen (dirname) + pupa_strlen (filename) + 1]; + char pathname[grub_strlen (dirname) + grub_strlen (filename) + 1]; if ((! all) && (filename[0] == '.')) return 0; if (! dir) { - pupa_file_t file; + grub_file_t file; - if (dirname[pupa_strlen (dirname) - 1] == '/') - pupa_sprintf (pathname, "%s%s", dirname, filename); + if (dirname[grub_strlen (dirname) - 1] == '/') + grub_sprintf (pathname, "%s%s", dirname, filename); else - pupa_sprintf (pathname, "%s/%s", dirname, filename); + grub_sprintf (pathname, "%s/%s", dirname, filename); /* XXX: For ext2fs symlinks are detected as files while they should be reported as directories. */ - file = pupa_file_open (pathname); + file = grub_file_open (pathname); if (! file) { - pupa_errno = 0; + grub_errno = 0; return 0; } if (! human) - pupa_printf ("%-12d", file->size); + grub_printf ("%-12d", file->size); else { float fsize = file->size; @@ -154,43 +154,43 @@ pupa_ls_list_files (const char *dirname, int longlist, int all, int human) if (units) { - pupa_sprintf (buf, "%0.2f%c", fsize, pupa_human_sizes[units]); - pupa_printf ("%-12s", buf); + grub_sprintf (buf, "%0.2f%c", fsize, grub_human_sizes[units]); + grub_printf ("%-12s", buf); } else - pupa_printf ("%-12d", file->size); + grub_printf ("%-12d", file->size); } (fs->close) (file); } else - pupa_printf ("%-12s", "DIR"); + grub_printf ("%-12s", "DIR"); - pupa_printf ("%s%s\n", filename, dir ? "/" : ""); + grub_printf ("%s%s\n", filename, dir ? "/" : ""); return 0; } - device_name = pupa_file_get_device_name (dirname); - dev = pupa_device_open (device_name); + device_name = grub_file_get_device_name (dirname); + dev = grub_device_open (device_name); if (! dev) goto fail; - fs = pupa_fs_probe (dev); - path = pupa_strchr (dirname, '/'); + fs = grub_fs_probe (dev); + path = grub_strchr (dirname, '/'); if (! path && ! device_name) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "invalid argument"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument"); goto fail; } if (! path) { - if (pupa_errno == PUPA_ERR_UNKNOWN_FS) - pupa_errno = PUPA_ERR_NONE; + if (grub_errno == GRUB_ERR_UNKNOWN_FS) + grub_errno = GRUB_ERR_NONE; - pupa_printf ("(%s): Filesystem is %s.\n", + grub_printf ("(%s): Filesystem is %s.\n", device_name, fs ? fs->name : "unknown"); } else if (fs) @@ -199,64 +199,64 @@ pupa_ls_list_files (const char *dirname, int longlist, int all, int human) (fs->dir) (dev, path, print_files_long); else (fs->dir) (dev, path, print_files); - pupa_putchar ('\n'); - pupa_refresh (); + grub_putchar ('\n'); + grub_refresh (); } fail: if (dev) - pupa_device_close (dev); + grub_device_close (dev); - pupa_free (device_name); + grub_free (device_name); return 0; } -static pupa_err_t -pupa_cmd_ls (struct pupa_arg_list *state, int argc, char **args) +static grub_err_t +grub_cmd_ls (struct grub_arg_list *state, int argc, char **args) { - static int pupa_ls_print_files (const char *filename, int dir) + static int grub_ls_print_files (const char *filename, int dir) { if (state[2].set/*all*/ || filename[0] != '.') - pupa_printf ("%s%s ", filename, dir ? "/" : ""); + grub_printf ("%s%s ", filename, dir ? "/" : ""); return 0; } if (argc == 0) - pupa_ls_list_disks (state[0].set); + grub_ls_list_disks (state[0].set); else - pupa_ls_list_files (args[0], state[0].set, state[2].set, + grub_ls_list_files (args[0], state[0].set, state[2].set, state[1].set); return 0; } -#ifdef PUPA_UTIL +#ifdef GRUB_UTIL void -pupa_ls_init (void) +grub_ls_init (void) { - pupa_register_command ("ls", pupa_cmd_ls, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH, "ls [OPTIONS...] [DIR]", "List devices and files", options); } void -pupa_ls_fini (void) +grub_ls_fini (void) { - pupa_unregister_command ("ls"); + grub_unregister_command ("ls"); } -#else /* ! PUPA_UTIL */ -PUPA_MOD_INIT +#else /* ! GRUB_UTIL */ +GRUB_MOD_INIT { (void)mod; /* To stop warning. */ - pupa_register_command ("ls", pupa_cmd_ls, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH, "ls [OPTIONS...] [DIR]", "List devices and files", options); } -PUPA_MOD_FINI +GRUB_MOD_FINI { - pupa_unregister_command ("ls"); + grub_unregister_command ("ls"); } -#endif /* ! PUPA_UTIL */ +#endif /* ! GRUB_UTIL */ diff --git a/commands/terminal.c b/commands/terminal.c index 52c2c85ee..b75fa65b1 100644 --- a/commands/terminal.c +++ b/commands/terminal.c @@ -1,9 +1,9 @@ /* terminal.c - command to show and select a terminal */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,34 +14,34 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -static pupa_err_t -pupa_cmd_terminal (struct pupa_arg_list *state __attribute__ ((unused)), +static grub_err_t +grub_cmd_terminal (struct grub_arg_list *state __attribute__ ((unused)), int argc, char **args) { - pupa_term_t term = 0; + grub_term_t term = 0; - auto int print_terminal (pupa_term_t); - auto int find_terminal (pupa_term_t); + auto int print_terminal (grub_term_t); + auto int find_terminal (grub_term_t); - int print_terminal (pupa_term_t t) + int print_terminal (grub_term_t t) { - pupa_printf (" %s", t->name); + grub_printf (" %s", t->name); return 0; } - int find_terminal (pupa_term_t t) + int find_terminal (grub_term_t t) { - if (pupa_strcmp (t->name, args[0]) == 0) + if (grub_strcmp (t->name, args[0]) == 0) { term = t; return 1; @@ -52,48 +52,48 @@ pupa_cmd_terminal (struct pupa_arg_list *state __attribute__ ((unused)), if (argc == 0) { - pupa_printf ("Available terminal(s):"); - pupa_term_iterate (print_terminal); - pupa_putchar ('\n'); + grub_printf ("Available terminal(s):"); + grub_term_iterate (print_terminal); + grub_putchar ('\n'); - pupa_printf ("Current terminal: %s\n", pupa_term_get_current ()->name); + grub_printf ("Current terminal: %s\n", grub_term_get_current ()->name); } else { - pupa_term_iterate (find_terminal); + grub_term_iterate (find_terminal); if (! term) - return pupa_error (PUPA_ERR_BAD_ARGUMENT, "no such terminal"); + return grub_error (GRUB_ERR_BAD_ARGUMENT, "no such terminal"); - pupa_term_set_current (term); + grub_term_set_current (term); } - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } -#ifdef PUPA_UTIL +#ifdef GRUB_UTIL void -pupa_terminal_init (void) +grub_terminal_init (void) { - pupa_register_command ("terminal", pupa_cmd_terminal, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("terminal", grub_cmd_terminal, GRUB_COMMAND_FLAG_BOTH, "terminal [TERM...]", "Select a terminal.", 0); } void -pupa_terminal_fini (void) +grub_terminal_fini (void) { - pupa_unregister_command ("terminal"); + grub_unregister_command ("terminal"); } -#else /* ! PUPA_UTIL */ -PUPA_MOD_INIT +#else /* ! GRUB_UTIL */ +GRUB_MOD_INIT { (void)mod; /* To stop warning. */ - pupa_register_command ("terminal", pupa_cmd_terminal, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("terminal", grub_cmd_terminal, GRUB_COMMAND_FLAG_BOTH, "terminal [TERM...]", "Select a terminal.", 0); } -PUPA_MOD_FINI +GRUB_MOD_FINI { - pupa_unregister_command ("terminal"); + grub_unregister_command ("terminal"); } -#endif /* ! PUPA_UTIL */ +#endif /* ! GRUB_UTIL */ diff --git a/conf/i386-pc.mk b/conf/i386-pc.mk index f0369d1b5..a0d35930f 100644 --- a/conf/i386-pc.mk +++ b/conf/i386-pc.mk @@ -239,432 +239,432 @@ kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,8200 MOSTLYCLEANFILES += symlist.c kernel_syms.lst DEFSYMFILES += kernel_syms.lst -symlist.c: $(addprefix include/pupa/,$(kernel_img_HEADERS)) gensymlist.sh +symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) gensymlist.sh sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@ -kernel_syms.lst: $(addprefix include/pupa/,$(kernel_img_HEADERS)) genkernsyms.sh +kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) genkernsyms.sh sh $(srcdir)/genkernsyms.sh $(filter %h,$^) > $@ # Utilities. -bin_UTILITIES = pupa-mkimage -sbin_UTILITIES = pupa-setup pupa-emu +bin_UTILITIES = grub-mkimage +sbin_UTILITIES = grub-setup grub-emu noinst_UTILITIES = genmoddep -# For pupa-mkimage. -pupa_mkimage_SOURCES = util/i386/pc/pupa-mkimage.c util/misc.c \ +# For grub-mkimage. +grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \ util/resolve.c -CLEANFILES += pupa-mkimage pupa_mkimage-util_i386_pc_pupa_mkimage.o pupa_mkimage-util_misc.o pupa_mkimage-util_resolve.o -MOSTLYCLEANFILES += pupa_mkimage-util_i386_pc_pupa_mkimage.d pupa_mkimage-util_misc.d pupa_mkimage-util_resolve.d +CLEANFILES += grub-mkimage grub_mkimage-util_i386_pc_grub_mkimage.o grub_mkimage-util_misc.o grub_mkimage-util_resolve.o +MOSTLYCLEANFILES += grub_mkimage-util_i386_pc_grub_mkimage.d grub_mkimage-util_misc.d grub_mkimage-util_resolve.d -pupa-mkimage: pupa_mkimage-util_i386_pc_pupa_mkimage.o pupa_mkimage-util_misc.o pupa_mkimage-util_resolve.o - $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(pupa_mkimage_LDFLAGS) +grub-mkimage: grub_mkimage-util_i386_pc_grub_mkimage.o grub_mkimage-util_misc.o grub_mkimage-util_resolve.o + $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_mkimage_LDFLAGS) -pupa_mkimage-util_i386_pc_pupa_mkimage.o: util/i386/pc/pupa-mkimage.c - $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_mkimage_CFLAGS) -c -o $@ $< +grub_mkimage-util_i386_pc_grub_mkimage.o: util/i386/pc/grub-mkimage.c + $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -c -o $@ $< -pupa_mkimage-util_i386_pc_pupa_mkimage.d: util/i386/pc/pupa-mkimage.c - set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_mkimage_CFLAGS) -M $< | sed 's,pupa\-mkimage\.o[ :]*,pupa_mkimage-util_i386_pc_pupa_mkimage.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_mkimage-util_i386_pc_grub_mkimage.d: util/i386/pc/grub-mkimage.c + set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -M $< | sed 's,grub\-mkimage\.o[ :]*,grub_mkimage-util_i386_pc_grub_mkimage.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_mkimage-util_i386_pc_pupa_mkimage.d +-include grub_mkimage-util_i386_pc_grub_mkimage.d -pupa_mkimage-util_misc.o: util/misc.c - $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_mkimage_CFLAGS) -c -o $@ $< +grub_mkimage-util_misc.o: util/misc.c + $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -c -o $@ $< -pupa_mkimage-util_misc.d: util/misc.c - set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_mkimage_CFLAGS) -M $< | sed 's,misc\.o[ :]*,pupa_mkimage-util_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_mkimage-util_misc.d: util/misc.c + set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -M $< | sed 's,misc\.o[ :]*,grub_mkimage-util_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_mkimage-util_misc.d +-include grub_mkimage-util_misc.d -pupa_mkimage-util_resolve.o: util/resolve.c - $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_mkimage_CFLAGS) -c -o $@ $< +grub_mkimage-util_resolve.o: util/resolve.c + $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -c -o $@ $< -pupa_mkimage-util_resolve.d: util/resolve.c - set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_mkimage_CFLAGS) -M $< | sed 's,resolve\.o[ :]*,pupa_mkimage-util_resolve.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_mkimage-util_resolve.d: util/resolve.c + set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_mkimage_CFLAGS) -M $< | sed 's,resolve\.o[ :]*,grub_mkimage-util_resolve.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_mkimage-util_resolve.d +-include grub_mkimage-util_resolve.d -pupa_mkimage_LDFLAGS = -llzo +grub_mkimage_LDFLAGS = -llzo -# For pupa-setup. -pupa_setup_SOURCES = util/i386/pc/pupa-setup.c util/i386/pc/biosdisk.c \ +# For grub-setup. +grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \ util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \ kern/err.c kern/misc.c disk/i386/pc/partition.c fs/fat.c fs/ext2.c \ kern/file.c kern/fs.c kern/env.c -CLEANFILES += pupa-setup pupa_setup-util_i386_pc_pupa_setup.o pupa_setup-util_i386_pc_biosdisk.o pupa_setup-util_misc.o pupa_setup-util_i386_pc_getroot.o pupa_setup-kern_device.o pupa_setup-kern_disk.o pupa_setup-kern_err.o pupa_setup-kern_misc.o pupa_setup-disk_i386_pc_partition.o pupa_setup-fs_fat.o pupa_setup-fs_ext2.o pupa_setup-kern_file.o pupa_setup-kern_fs.o pupa_setup-kern_env.o -MOSTLYCLEANFILES += pupa_setup-util_i386_pc_pupa_setup.d pupa_setup-util_i386_pc_biosdisk.d pupa_setup-util_misc.d pupa_setup-util_i386_pc_getroot.d pupa_setup-kern_device.d pupa_setup-kern_disk.d pupa_setup-kern_err.d pupa_setup-kern_misc.d pupa_setup-disk_i386_pc_partition.d pupa_setup-fs_fat.d pupa_setup-fs_ext2.d pupa_setup-kern_file.d pupa_setup-kern_fs.d pupa_setup-kern_env.d +CLEANFILES += grub-setup grub_setup-util_i386_pc_grub_setup.o grub_setup-util_i386_pc_biosdisk.o grub_setup-util_misc.o grub_setup-util_i386_pc_getroot.o grub_setup-kern_device.o grub_setup-kern_disk.o grub_setup-kern_err.o grub_setup-kern_misc.o grub_setup-disk_i386_pc_partition.o grub_setup-fs_fat.o grub_setup-fs_ext2.o grub_setup-kern_file.o grub_setup-kern_fs.o grub_setup-kern_env.o +MOSTLYCLEANFILES += grub_setup-util_i386_pc_grub_setup.d grub_setup-util_i386_pc_biosdisk.d grub_setup-util_misc.d grub_setup-util_i386_pc_getroot.d grub_setup-kern_device.d grub_setup-kern_disk.d grub_setup-kern_err.d grub_setup-kern_misc.d grub_setup-disk_i386_pc_partition.d grub_setup-fs_fat.d grub_setup-fs_ext2.d grub_setup-kern_file.d grub_setup-kern_fs.d grub_setup-kern_env.d -pupa-setup: pupa_setup-util_i386_pc_pupa_setup.o pupa_setup-util_i386_pc_biosdisk.o pupa_setup-util_misc.o pupa_setup-util_i386_pc_getroot.o pupa_setup-kern_device.o pupa_setup-kern_disk.o pupa_setup-kern_err.o pupa_setup-kern_misc.o pupa_setup-disk_i386_pc_partition.o pupa_setup-fs_fat.o pupa_setup-fs_ext2.o pupa_setup-kern_file.o pupa_setup-kern_fs.o pupa_setup-kern_env.o - $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(pupa_setup_LDFLAGS) +grub-setup: grub_setup-util_i386_pc_grub_setup.o grub_setup-util_i386_pc_biosdisk.o grub_setup-util_misc.o grub_setup-util_i386_pc_getroot.o grub_setup-kern_device.o grub_setup-kern_disk.o grub_setup-kern_err.o grub_setup-kern_misc.o grub_setup-disk_i386_pc_partition.o grub_setup-fs_fat.o grub_setup-fs_ext2.o grub_setup-kern_file.o grub_setup-kern_fs.o grub_setup-kern_env.o + $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_setup_LDFLAGS) -pupa_setup-util_i386_pc_pupa_setup.o: util/i386/pc/pupa-setup.c - $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -c -o $@ $< +grub_setup-util_i386_pc_grub_setup.o: util/i386/pc/grub-setup.c + $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $< -pupa_setup-util_i386_pc_pupa_setup.d: util/i386/pc/pupa-setup.c - set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -M $< | sed 's,pupa\-setup\.o[ :]*,pupa_setup-util_i386_pc_pupa_setup.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_setup-util_i386_pc_grub_setup.d: util/i386/pc/grub-setup.c + set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,grub\-setup\.o[ :]*,grub_setup-util_i386_pc_grub_setup.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_setup-util_i386_pc_pupa_setup.d +-include grub_setup-util_i386_pc_grub_setup.d -pupa_setup-util_i386_pc_biosdisk.o: util/i386/pc/biosdisk.c - $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -c -o $@ $< +grub_setup-util_i386_pc_biosdisk.o: util/i386/pc/biosdisk.c + $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $< -pupa_setup-util_i386_pc_biosdisk.d: util/i386/pc/biosdisk.c - set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -M $< | sed 's,biosdisk\.o[ :]*,pupa_setup-util_i386_pc_biosdisk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_setup-util_i386_pc_biosdisk.d: util/i386/pc/biosdisk.c + set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,biosdisk\.o[ :]*,grub_setup-util_i386_pc_biosdisk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_setup-util_i386_pc_biosdisk.d +-include grub_setup-util_i386_pc_biosdisk.d -pupa_setup-util_misc.o: util/misc.c - $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -c -o $@ $< +grub_setup-util_misc.o: util/misc.c + $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $< -pupa_setup-util_misc.d: util/misc.c - set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -M $< | sed 's,misc\.o[ :]*,pupa_setup-util_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_setup-util_misc.d: util/misc.c + set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,misc\.o[ :]*,grub_setup-util_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_setup-util_misc.d +-include grub_setup-util_misc.d -pupa_setup-util_i386_pc_getroot.o: util/i386/pc/getroot.c - $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -c -o $@ $< +grub_setup-util_i386_pc_getroot.o: util/i386/pc/getroot.c + $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $< -pupa_setup-util_i386_pc_getroot.d: util/i386/pc/getroot.c - set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -M $< | sed 's,getroot\.o[ :]*,pupa_setup-util_i386_pc_getroot.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_setup-util_i386_pc_getroot.d: util/i386/pc/getroot.c + set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,getroot\.o[ :]*,grub_setup-util_i386_pc_getroot.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_setup-util_i386_pc_getroot.d +-include grub_setup-util_i386_pc_getroot.d -pupa_setup-kern_device.o: kern/device.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -c -o $@ $< +grub_setup-kern_device.o: kern/device.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $< -pupa_setup-kern_device.d: kern/device.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -M $< | sed 's,device\.o[ :]*,pupa_setup-kern_device.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_setup-kern_device.d: kern/device.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,device\.o[ :]*,grub_setup-kern_device.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_setup-kern_device.d +-include grub_setup-kern_device.d -pupa_setup-kern_disk.o: kern/disk.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -c -o $@ $< +grub_setup-kern_disk.o: kern/disk.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $< -pupa_setup-kern_disk.d: kern/disk.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -M $< | sed 's,disk\.o[ :]*,pupa_setup-kern_disk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_setup-kern_disk.d: kern/disk.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,disk\.o[ :]*,grub_setup-kern_disk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_setup-kern_disk.d +-include grub_setup-kern_disk.d -pupa_setup-kern_err.o: kern/err.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -c -o $@ $< +grub_setup-kern_err.o: kern/err.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $< -pupa_setup-kern_err.d: kern/err.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -M $< | sed 's,err\.o[ :]*,pupa_setup-kern_err.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_setup-kern_err.d: kern/err.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,err\.o[ :]*,grub_setup-kern_err.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_setup-kern_err.d +-include grub_setup-kern_err.d -pupa_setup-kern_misc.o: kern/misc.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -c -o $@ $< +grub_setup-kern_misc.o: kern/misc.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $< -pupa_setup-kern_misc.d: kern/misc.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -M $< | sed 's,misc\.o[ :]*,pupa_setup-kern_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_setup-kern_misc.d: kern/misc.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,misc\.o[ :]*,grub_setup-kern_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_setup-kern_misc.d +-include grub_setup-kern_misc.d -pupa_setup-disk_i386_pc_partition.o: disk/i386/pc/partition.c - $(BUILD_CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -c -o $@ $< +grub_setup-disk_i386_pc_partition.o: disk/i386/pc/partition.c + $(BUILD_CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $< -pupa_setup-disk_i386_pc_partition.d: disk/i386/pc/partition.c - set -e; $(BUILD_CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -M $< | sed 's,partition\.o[ :]*,pupa_setup-disk_i386_pc_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_setup-disk_i386_pc_partition.d: disk/i386/pc/partition.c + set -e; $(BUILD_CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,partition\.o[ :]*,grub_setup-disk_i386_pc_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_setup-disk_i386_pc_partition.d +-include grub_setup-disk_i386_pc_partition.d -pupa_setup-fs_fat.o: fs/fat.c - $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -c -o $@ $< +grub_setup-fs_fat.o: fs/fat.c + $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $< -pupa_setup-fs_fat.d: fs/fat.c - set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -M $< | sed 's,fat\.o[ :]*,pupa_setup-fs_fat.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_setup-fs_fat.d: fs/fat.c + set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,fat\.o[ :]*,grub_setup-fs_fat.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_setup-fs_fat.d +-include grub_setup-fs_fat.d -pupa_setup-fs_ext2.o: fs/ext2.c - $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -c -o $@ $< +grub_setup-fs_ext2.o: fs/ext2.c + $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $< -pupa_setup-fs_ext2.d: fs/ext2.c - set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -M $< | sed 's,ext2\.o[ :]*,pupa_setup-fs_ext2.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_setup-fs_ext2.d: fs/ext2.c + set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,ext2\.o[ :]*,grub_setup-fs_ext2.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_setup-fs_ext2.d +-include grub_setup-fs_ext2.d -pupa_setup-kern_file.o: kern/file.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -c -o $@ $< +grub_setup-kern_file.o: kern/file.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $< -pupa_setup-kern_file.d: kern/file.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -M $< | sed 's,file\.o[ :]*,pupa_setup-kern_file.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_setup-kern_file.d: kern/file.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,file\.o[ :]*,grub_setup-kern_file.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_setup-kern_file.d +-include grub_setup-kern_file.d -pupa_setup-kern_fs.o: kern/fs.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -c -o $@ $< +grub_setup-kern_fs.o: kern/fs.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $< -pupa_setup-kern_fs.d: kern/fs.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -M $< | sed 's,fs\.o[ :]*,pupa_setup-kern_fs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_setup-kern_fs.d: kern/fs.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,fs\.o[ :]*,grub_setup-kern_fs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_setup-kern_fs.d +-include grub_setup-kern_fs.d -pupa_setup-kern_env.o: kern/env.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -c -o $@ $< +grub_setup-kern_env.o: kern/env.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -c -o $@ $< -pupa_setup-kern_env.d: kern/env.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_setup_CFLAGS) -M $< | sed 's,env\.o[ :]*,pupa_setup-kern_env.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_setup-kern_env.d: kern/env.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_setup_CFLAGS) -M $< | sed 's,env\.o[ :]*,grub_setup-kern_env.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_setup-kern_env.d +-include grub_setup-kern_env.d -# For pupa -pupa_emu_SOURCES = kern/main.c kern/device.c \ +# For grub +grub_emu_SOURCES = 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/loader.c kern/rescue.c kern/term.c \ disk/i386/pc/partition.c kern/env.c commands/ls.c \ commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c \ util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c \ normal/cmdline.c normal/command.c normal/main.c normal/menu.c normal/arg.c \ - util/console.c util/pupa-emu.c util/misc.c util/i386/pc/getroot.c -CLEANFILES += pupa-emu pupa_emu-kern_main.o pupa_emu-kern_device.o pupa_emu-kern_disk.o pupa_emu-kern_dl.o pupa_emu-kern_file.o pupa_emu-kern_fs.o pupa_emu-kern_err.o pupa_emu-kern_misc.o pupa_emu-kern_loader.o pupa_emu-kern_rescue.o pupa_emu-kern_term.o pupa_emu-disk_i386_pc_partition.o pupa_emu-kern_env.o pupa_emu-commands_ls.o pupa_emu-commands_terminal.o pupa_emu-commands_boot.o pupa_emu-commands_cmp.o pupa_emu-commands_cat.o pupa_emu-util_i386_pc_biosdisk.o pupa_emu-fs_fat.o pupa_emu-fs_ext2.o pupa_emu-normal_cmdline.o pupa_emu-normal_command.o pupa_emu-normal_main.o pupa_emu-normal_menu.o pupa_emu-normal_arg.o pupa_emu-util_console.o pupa_emu-util_pupa_emu.o pupa_emu-util_misc.o pupa_emu-util_i386_pc_getroot.o -MOSTLYCLEANFILES += pupa_emu-kern_main.d pupa_emu-kern_device.d pupa_emu-kern_disk.d pupa_emu-kern_dl.d pupa_emu-kern_file.d pupa_emu-kern_fs.d pupa_emu-kern_err.d pupa_emu-kern_misc.d pupa_emu-kern_loader.d pupa_emu-kern_rescue.d pupa_emu-kern_term.d pupa_emu-disk_i386_pc_partition.d pupa_emu-kern_env.d pupa_emu-commands_ls.d pupa_emu-commands_terminal.d pupa_emu-commands_boot.d pupa_emu-commands_cmp.d pupa_emu-commands_cat.d pupa_emu-util_i386_pc_biosdisk.d pupa_emu-fs_fat.d pupa_emu-fs_ext2.d pupa_emu-normal_cmdline.d pupa_emu-normal_command.d pupa_emu-normal_main.d pupa_emu-normal_menu.d pupa_emu-normal_arg.d pupa_emu-util_console.d pupa_emu-util_pupa_emu.d pupa_emu-util_misc.d pupa_emu-util_i386_pc_getroot.d + util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c +CLEANFILES += grub-emu grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-disk_i386_pc_partition.o grub_emu-kern_env.o grub_emu-commands_ls.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o +MOSTLYCLEANFILES += grub_emu-kern_main.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_err.d grub_emu-kern_misc.d grub_emu-kern_loader.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-disk_i386_pc_partition.d grub_emu-kern_env.d grub_emu-commands_ls.d grub_emu-commands_terminal.d grub_emu-commands_boot.d grub_emu-commands_cmp.d grub_emu-commands_cat.d grub_emu-util_i386_pc_biosdisk.d grub_emu-fs_fat.d grub_emu-fs_ext2.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-normal_arg.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_getroot.d -pupa-emu: pupa_emu-kern_main.o pupa_emu-kern_device.o pupa_emu-kern_disk.o pupa_emu-kern_dl.o pupa_emu-kern_file.o pupa_emu-kern_fs.o pupa_emu-kern_err.o pupa_emu-kern_misc.o pupa_emu-kern_loader.o pupa_emu-kern_rescue.o pupa_emu-kern_term.o pupa_emu-disk_i386_pc_partition.o pupa_emu-kern_env.o pupa_emu-commands_ls.o pupa_emu-commands_terminal.o pupa_emu-commands_boot.o pupa_emu-commands_cmp.o pupa_emu-commands_cat.o pupa_emu-util_i386_pc_biosdisk.o pupa_emu-fs_fat.o pupa_emu-fs_ext2.o pupa_emu-normal_cmdline.o pupa_emu-normal_command.o pupa_emu-normal_main.o pupa_emu-normal_menu.o pupa_emu-normal_arg.o pupa_emu-util_console.o pupa_emu-util_pupa_emu.o pupa_emu-util_misc.o pupa_emu-util_i386_pc_getroot.o - $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(pupa_emu_LDFLAGS) +grub-emu: grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-disk_i386_pc_partition.o grub_emu-kern_env.o grub_emu-commands_ls.o grub_emu-commands_terminal.o grub_emu-commands_boot.o grub_emu-commands_cmp.o grub_emu-commands_cat.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o + $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS) -pupa_emu-kern_main.o: kern/main.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_main.o: kern/main.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_main.d: kern/main.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,main\.o[ :]*,pupa_emu-kern_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_main.d: kern/main.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,main\.o[ :]*,grub_emu-kern_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_main.d +-include grub_emu-kern_main.d -pupa_emu-kern_device.o: kern/device.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_device.o: kern/device.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_device.d: kern/device.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,device\.o[ :]*,pupa_emu-kern_device.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_device.d: kern/device.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,device\.o[ :]*,grub_emu-kern_device.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_device.d +-include grub_emu-kern_device.d -pupa_emu-kern_disk.o: kern/disk.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_disk.o: kern/disk.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_disk.d: kern/disk.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,disk\.o[ :]*,pupa_emu-kern_disk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_disk.d: kern/disk.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,disk\.o[ :]*,grub_emu-kern_disk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_disk.d +-include grub_emu-kern_disk.d -pupa_emu-kern_dl.o: kern/dl.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_dl.o: kern/dl.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_dl.d: kern/dl.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,dl\.o[ :]*,pupa_emu-kern_dl.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_dl.d: kern/dl.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,dl\.o[ :]*,grub_emu-kern_dl.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_dl.d +-include grub_emu-kern_dl.d -pupa_emu-kern_file.o: kern/file.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_file.o: kern/file.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_file.d: kern/file.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,file\.o[ :]*,pupa_emu-kern_file.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_file.d: kern/file.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,file\.o[ :]*,grub_emu-kern_file.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_file.d +-include grub_emu-kern_file.d -pupa_emu-kern_fs.o: kern/fs.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_fs.o: kern/fs.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_fs.d: kern/fs.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,fs\.o[ :]*,pupa_emu-kern_fs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_fs.d: kern/fs.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,fs\.o[ :]*,grub_emu-kern_fs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_fs.d +-include grub_emu-kern_fs.d -pupa_emu-kern_err.o: kern/err.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_err.o: kern/err.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_err.d: kern/err.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,err\.o[ :]*,pupa_emu-kern_err.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_err.d: kern/err.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,err\.o[ :]*,grub_emu-kern_err.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_err.d +-include grub_emu-kern_err.d -pupa_emu-kern_misc.o: kern/misc.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_misc.o: kern/misc.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_misc.d: kern/misc.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,misc\.o[ :]*,pupa_emu-kern_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_misc.d: kern/misc.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,misc\.o[ :]*,grub_emu-kern_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_misc.d +-include grub_emu-kern_misc.d -pupa_emu-kern_loader.o: kern/loader.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_loader.o: kern/loader.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_loader.d: kern/loader.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,loader\.o[ :]*,pupa_emu-kern_loader.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_loader.d: kern/loader.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,loader\.o[ :]*,grub_emu-kern_loader.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_loader.d +-include grub_emu-kern_loader.d -pupa_emu-kern_rescue.o: kern/rescue.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_rescue.o: kern/rescue.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_rescue.d: kern/rescue.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,rescue\.o[ :]*,pupa_emu-kern_rescue.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_rescue.d: kern/rescue.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,rescue\.o[ :]*,grub_emu-kern_rescue.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_rescue.d +-include grub_emu-kern_rescue.d -pupa_emu-kern_term.o: kern/term.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_term.o: kern/term.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_term.d: kern/term.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,term\.o[ :]*,pupa_emu-kern_term.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_term.d: kern/term.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,term\.o[ :]*,grub_emu-kern_term.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_term.d +-include grub_emu-kern_term.d -pupa_emu-disk_i386_pc_partition.o: disk/i386/pc/partition.c - $(BUILD_CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-disk_i386_pc_partition.o: disk/i386/pc/partition.c + $(BUILD_CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-disk_i386_pc_partition.d: disk/i386/pc/partition.c - set -e; $(BUILD_CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,partition\.o[ :]*,pupa_emu-disk_i386_pc_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-disk_i386_pc_partition.d: disk/i386/pc/partition.c + set -e; $(BUILD_CC) -Idisk/i386/pc -I$(srcdir)/disk/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,partition\.o[ :]*,grub_emu-disk_i386_pc_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-disk_i386_pc_partition.d +-include grub_emu-disk_i386_pc_partition.d -pupa_emu-kern_env.o: kern/env.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_env.o: kern/env.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_env.d: kern/env.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,env\.o[ :]*,pupa_emu-kern_env.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_env.d: kern/env.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,env\.o[ :]*,grub_emu-kern_env.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_env.d +-include grub_emu-kern_env.d -pupa_emu-commands_ls.o: commands/ls.c - $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-commands_ls.o: commands/ls.c + $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-commands_ls.d: commands/ls.c - set -e; $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,ls\.o[ :]*,pupa_emu-commands_ls.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-commands_ls.d: commands/ls.c + set -e; $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,ls\.o[ :]*,grub_emu-commands_ls.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-commands_ls.d +-include grub_emu-commands_ls.d -pupa_emu-commands_terminal.o: commands/terminal.c - $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-commands_terminal.o: commands/terminal.c + $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-commands_terminal.d: commands/terminal.c - set -e; $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,terminal\.o[ :]*,pupa_emu-commands_terminal.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-commands_terminal.d: commands/terminal.c + set -e; $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,terminal\.o[ :]*,grub_emu-commands_terminal.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-commands_terminal.d +-include grub_emu-commands_terminal.d -pupa_emu-commands_boot.o: commands/boot.c - $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-commands_boot.o: commands/boot.c + $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-commands_boot.d: commands/boot.c - set -e; $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,boot\.o[ :]*,pupa_emu-commands_boot.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-commands_boot.d: commands/boot.c + set -e; $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,boot\.o[ :]*,grub_emu-commands_boot.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-commands_boot.d +-include grub_emu-commands_boot.d -pupa_emu-commands_cmp.o: commands/cmp.c - $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-commands_cmp.o: commands/cmp.c + $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-commands_cmp.d: commands/cmp.c - set -e; $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,cmp\.o[ :]*,pupa_emu-commands_cmp.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-commands_cmp.d: commands/cmp.c + set -e; $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,cmp\.o[ :]*,grub_emu-commands_cmp.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-commands_cmp.d +-include grub_emu-commands_cmp.d -pupa_emu-commands_cat.o: commands/cat.c - $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-commands_cat.o: commands/cat.c + $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-commands_cat.d: commands/cat.c - set -e; $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,cat\.o[ :]*,pupa_emu-commands_cat.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-commands_cat.d: commands/cat.c + set -e; $(BUILD_CC) -Icommands -I$(srcdir)/commands $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,cat\.o[ :]*,grub_emu-commands_cat.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-commands_cat.d +-include grub_emu-commands_cat.d -pupa_emu-util_i386_pc_biosdisk.o: util/i386/pc/biosdisk.c - $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-util_i386_pc_biosdisk.o: util/i386/pc/biosdisk.c + $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-util_i386_pc_biosdisk.d: util/i386/pc/biosdisk.c - set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,biosdisk\.o[ :]*,pupa_emu-util_i386_pc_biosdisk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-util_i386_pc_biosdisk.d: util/i386/pc/biosdisk.c + set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,biosdisk\.o[ :]*,grub_emu-util_i386_pc_biosdisk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-util_i386_pc_biosdisk.d +-include grub_emu-util_i386_pc_biosdisk.d -pupa_emu-fs_fat.o: fs/fat.c - $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-fs_fat.o: fs/fat.c + $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-fs_fat.d: fs/fat.c - set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,fat\.o[ :]*,pupa_emu-fs_fat.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-fs_fat.d: fs/fat.c + set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,fat\.o[ :]*,grub_emu-fs_fat.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-fs_fat.d +-include grub_emu-fs_fat.d -pupa_emu-fs_ext2.o: fs/ext2.c - $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-fs_ext2.o: fs/ext2.c + $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-fs_ext2.d: fs/ext2.c - set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,ext2\.o[ :]*,pupa_emu-fs_ext2.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-fs_ext2.d: fs/ext2.c + set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,ext2\.o[ :]*,grub_emu-fs_ext2.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-fs_ext2.d +-include grub_emu-fs_ext2.d -pupa_emu-normal_cmdline.o: normal/cmdline.c - $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-normal_cmdline.o: normal/cmdline.c + $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-normal_cmdline.d: normal/cmdline.c - set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,cmdline\.o[ :]*,pupa_emu-normal_cmdline.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-normal_cmdline.d: normal/cmdline.c + set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,cmdline\.o[ :]*,grub_emu-normal_cmdline.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-normal_cmdline.d +-include grub_emu-normal_cmdline.d -pupa_emu-normal_command.o: normal/command.c - $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-normal_command.o: normal/command.c + $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-normal_command.d: normal/command.c - set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,command\.o[ :]*,pupa_emu-normal_command.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-normal_command.d: normal/command.c + set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,command\.o[ :]*,grub_emu-normal_command.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-normal_command.d +-include grub_emu-normal_command.d -pupa_emu-normal_main.o: normal/main.c - $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-normal_main.o: normal/main.c + $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-normal_main.d: normal/main.c - set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,main\.o[ :]*,pupa_emu-normal_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-normal_main.d: normal/main.c + set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,main\.o[ :]*,grub_emu-normal_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-normal_main.d +-include grub_emu-normal_main.d -pupa_emu-normal_menu.o: normal/menu.c - $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-normal_menu.o: normal/menu.c + $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-normal_menu.d: normal/menu.c - set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,menu\.o[ :]*,pupa_emu-normal_menu.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-normal_menu.d: normal/menu.c + set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,menu\.o[ :]*,grub_emu-normal_menu.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-normal_menu.d +-include grub_emu-normal_menu.d -pupa_emu-normal_arg.o: normal/arg.c - $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-normal_arg.o: normal/arg.c + $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-normal_arg.d: normal/arg.c - set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,arg\.o[ :]*,pupa_emu-normal_arg.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-normal_arg.d: normal/arg.c + set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,arg\.o[ :]*,grub_emu-normal_arg.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-normal_arg.d +-include grub_emu-normal_arg.d -pupa_emu-util_console.o: util/console.c - $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-util_console.o: util/console.c + $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-util_console.d: util/console.c - set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,console\.o[ :]*,pupa_emu-util_console.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-util_console.d: util/console.c + set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,console\.o[ :]*,grub_emu-util_console.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-util_console.d +-include grub_emu-util_console.d -pupa_emu-util_pupa_emu.o: util/pupa-emu.c - $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-util_grub_emu.o: util/grub-emu.c + $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-util_pupa_emu.d: util/pupa-emu.c - set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,pupa\-emu\.o[ :]*,pupa_emu-util_pupa_emu.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-util_grub_emu.d: util/grub-emu.c + set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,grub\-emu\.o[ :]*,grub_emu-util_grub_emu.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-util_pupa_emu.d +-include grub_emu-util_grub_emu.d -pupa_emu-util_misc.o: util/misc.c - $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-util_misc.o: util/misc.c + $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-util_misc.d: util/misc.c - set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,misc\.o[ :]*,pupa_emu-util_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-util_misc.d: util/misc.c + set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,misc\.o[ :]*,grub_emu-util_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-util_misc.d +-include grub_emu-util_misc.d -pupa_emu-util_i386_pc_getroot.o: util/i386/pc/getroot.c - $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-util_i386_pc_getroot.o: util/i386/pc/getroot.c + $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-util_i386_pc_getroot.d: util/i386/pc/getroot.c - set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,getroot\.o[ :]*,pupa_emu-util_i386_pc_getroot.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-util_i386_pc_getroot.d: util/i386/pc/getroot.c + set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,getroot\.o[ :]*,grub_emu-util_i386_pc_getroot.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-util_i386_pc_getroot.d +-include grub_emu-util_i386_pc_getroot.d -pupa_emu_LDFLAGS = -lncurses +grub_emu_LDFLAGS = -lncurses # For genmoddep. genmoddep_SOURCES = util/genmoddep.c @@ -675,10 +675,10 @@ genmoddep: genmoddep-util_genmoddep.o $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(genmoddep_LDFLAGS) genmoddep-util_genmoddep.o: util/genmoddep.c - $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(genmoddep_CFLAGS) -c -o $@ $< + $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(genmoddep_CFLAGS) -c -o $@ $< genmoddep-util_genmoddep.d: util/genmoddep.c - set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(genmoddep_CFLAGS) -M $< | sed 's,genmoddep\.o[ :]*,genmoddep-util_genmoddep.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(genmoddep_CFLAGS) -M $< | sed 's,genmoddep\.o[ :]*,genmoddep-util_genmoddep.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ -include genmoddep-util_genmoddep.d @@ -697,7 +697,7 @@ UNDSYMFILES += und-_chain.lst _chain.mod: pre-_chain.o mod-_chain.o -rm -f $@ $(LD) -r -o $@ $^ - $(STRIP) --strip-unneeded -K pupa_mod_init -K pupa_mod_fini -R .note -R .comment $@ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-_chain.o: _chain_mod-loader_i386_pc_chainloader.o -rm -f $@ @@ -736,7 +736,7 @@ UNDSYMFILES += und-fat.lst fat.mod: pre-fat.o mod-fat.o -rm -f $@ $(LD) -r -o $@ $^ - $(STRIP) --strip-unneeded -K pupa_mod_init -K pupa_mod_fini -R .note -R .comment $@ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-fat.o: fat_mod-fs_fat.o -rm -f $@ @@ -775,7 +775,7 @@ UNDSYMFILES += und-ext2.lst ext2.mod: pre-ext2.o mod-ext2.o -rm -f $@ $(LD) -r -o $@ $^ - $(STRIP) --strip-unneeded -K pupa_mod_init -K pupa_mod_fini -R .note -R .comment $@ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-ext2.o: ext2_mod-fs_ext2.o -rm -f $@ @@ -814,7 +814,7 @@ UNDSYMFILES += und-_linux.lst _linux.mod: pre-_linux.o mod-_linux.o -rm -f $@ $(LD) -r -o $@ $^ - $(STRIP) --strip-unneeded -K pupa_mod_init -K pupa_mod_fini -R .note -R .comment $@ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-_linux.o: _linux_mod-loader_i386_pc_linux.o -rm -f $@ @@ -854,7 +854,7 @@ UNDSYMFILES += und-normal.lst normal.mod: pre-normal.o mod-normal.o -rm -f $@ $(LD) -r -o $@ $^ - $(STRIP) --strip-unneeded -K pupa_mod_init -K pupa_mod_fini -R .note -R .comment $@ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-normal.o: normal_mod-normal_cmdline.o normal_mod-normal_command.o normal_mod-normal_main.o normal_mod-normal_menu.o normal_mod-normal_arg.o normal_mod-normal_i386_setjmp.o -rm -f $@ @@ -934,7 +934,7 @@ UNDSYMFILES += und-hello.lst hello.mod: pre-hello.o mod-hello.o -rm -f $@ $(LD) -r -o $@ $^ - $(STRIP) --strip-unneeded -K pupa_mod_init -K pupa_mod_fini -R .note -R .comment $@ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-hello.o: hello_mod-hello_hello.o -rm -f $@ @@ -973,7 +973,7 @@ UNDSYMFILES += und-boot.lst boot.mod: pre-boot.o mod-boot.o -rm -f $@ $(LD) -r -o $@ $^ - $(STRIP) --strip-unneeded -K pupa_mod_init -K pupa_mod_fini -R .note -R .comment $@ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-boot.o: boot_mod-commands_boot.o -rm -f $@ @@ -1012,7 +1012,7 @@ UNDSYMFILES += und-terminal.lst terminal.mod: pre-terminal.o mod-terminal.o -rm -f $@ $(LD) -r -o $@ $^ - $(STRIP) --strip-unneeded -K pupa_mod_init -K pupa_mod_fini -R .note -R .comment $@ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-terminal.o: terminal_mod-commands_terminal.o -rm -f $@ @@ -1051,7 +1051,7 @@ UNDSYMFILES += und-ls.lst ls.mod: pre-ls.o mod-ls.o -rm -f $@ $(LD) -r -o $@ $^ - $(STRIP) --strip-unneeded -K pupa_mod_init -K pupa_mod_fini -R .note -R .comment $@ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-ls.o: ls_mod-commands_ls.o -rm -f $@ @@ -1090,7 +1090,7 @@ UNDSYMFILES += und-cmp.lst cmp.mod: pre-cmp.o mod-cmp.o -rm -f $@ $(LD) -r -o $@ $^ - $(STRIP) --strip-unneeded -K pupa_mod_init -K pupa_mod_fini -R .note -R .comment $@ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-cmp.o: cmp_mod-commands_cmp.o -rm -f $@ @@ -1129,7 +1129,7 @@ UNDSYMFILES += und-cat.lst cat.mod: pre-cat.o mod-cat.o -rm -f $@ $(LD) -r -o $@ $^ - $(STRIP) --strip-unneeded -K pupa_mod_init -K pupa_mod_fini -R .note -R .comment $@ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-cat.o: cat_mod-commands_cat.o -rm -f $@ @@ -1168,7 +1168,7 @@ UNDSYMFILES += und-vga.lst vga.mod: pre-vga.o mod-vga.o -rm -f $@ $(LD) -r -o $@ $^ - $(STRIP) --strip-unneeded -K pupa_mod_init -K pupa_mod_fini -R .note -R .comment $@ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-vga.o: vga_mod-term_i386_pc_vga.o -rm -f $@ @@ -1207,7 +1207,7 @@ UNDSYMFILES += und-font.lst font.mod: pre-font.o mod-font.o -rm -f $@ $(LD) -r -o $@ $^ - $(STRIP) --strip-unneeded -K pupa_mod_init -K pupa_mod_fini -R .note -R .comment $@ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-font.o: font_mod-font_manager.o -rm -f $@ @@ -1246,7 +1246,7 @@ UNDSYMFILES += und-_multiboot.lst _multiboot.mod: pre-_multiboot.o mod-_multiboot.o -rm -f $@ $(LD) -r -o $@ $^ - $(STRIP) --strip-unneeded -K pupa_mod_init -K pupa_mod_fini -R .note -R .comment $@ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ pre-_multiboot.o: _multiboot_mod-loader_i386_pc_multiboot.o -rm -f $@ diff --git a/conf/i386-pc.rmk b/conf/i386-pc.rmk index b50bb1257..c304ad7bd 100644 --- a/conf/i386-pc.rmk +++ b/conf/i386-pc.rmk @@ -36,38 +36,38 @@ kernel_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,8200 MOSTLYCLEANFILES += symlist.c kernel_syms.lst DEFSYMFILES += kernel_syms.lst -symlist.c: $(addprefix include/pupa/,$(kernel_img_HEADERS)) gensymlist.sh +symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) gensymlist.sh sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@ -kernel_syms.lst: $(addprefix include/pupa/,$(kernel_img_HEADERS)) genkernsyms.sh +kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) genkernsyms.sh sh $(srcdir)/genkernsyms.sh $(filter %h,$^) > $@ # Utilities. -bin_UTILITIES = pupa-mkimage -sbin_UTILITIES = pupa-setup pupa-emu +bin_UTILITIES = grub-mkimage +sbin_UTILITIES = grub-setup grub-emu noinst_UTILITIES = genmoddep -# For pupa-mkimage. -pupa_mkimage_SOURCES = util/i386/pc/pupa-mkimage.c util/misc.c \ +# For grub-mkimage. +grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \ util/resolve.c -pupa_mkimage_LDFLAGS = -llzo +grub_mkimage_LDFLAGS = -llzo -# For pupa-setup. -pupa_setup_SOURCES = util/i386/pc/pupa-setup.c util/i386/pc/biosdisk.c \ +# For grub-setup. +grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \ util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \ kern/err.c kern/misc.c disk/i386/pc/partition.c fs/fat.c fs/ext2.c \ kern/file.c kern/fs.c kern/env.c -# For pupa -pupa_emu_SOURCES = kern/main.c kern/device.c \ +# For grub +grub_emu_SOURCES = 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/loader.c kern/rescue.c kern/term.c \ disk/i386/pc/partition.c kern/env.c commands/ls.c \ commands/terminal.c commands/boot.c commands/cmp.c commands/cat.c \ util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c \ normal/cmdline.c normal/command.c normal/main.c normal/menu.c normal/arg.c \ - util/console.c util/pupa-emu.c util/misc.c util/i386/pc/getroot.c -pupa_emu_LDFLAGS = -lncurses + util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c +grub_emu_LDFLAGS = -lncurses # For genmoddep. genmoddep_SOURCES = util/genmoddep.c diff --git a/conf/powerpc-ieee1275.mk b/conf/powerpc-ieee1275.mk index 65883b094..d73e97546 100644 --- a/conf/powerpc-ieee1275.mk +++ b/conf/powerpc-ieee1275.mk @@ -9,227 +9,227 @@ COMMON_CFLAGS = -fno-builtin -D__ASSEMBLY__ MOSTLYCLEANFILES += symlist.c kernel_syms.lst DEFSYMFILES += kernel_syms.lst -symlist.c: $(addprefix include/pupa/,$(kernel_img_HEADERS)) gensymlist.sh +symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) gensymlist.sh sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@ -kernel_syms.lst: $(addprefix include/pupa/,$(kernel_img_HEADERS)) genkernsyms.sh +kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) genkernsyms.sh sh $(srcdir)/genkernsyms.sh $(filter %h,$^) > $@ # Utilities. -sbin_UTILITIES = pupaof -bin_UTILITIES = pupa-emu +sbin_UTILITIES = grubof +bin_UTILITIES = grub-emu noinst_UTILITIES = genmoddep -# For pupa-emu -pupa_emu_SOURCES = kern/main.c kern/device.c \ +# For grub-emu +grub_emu_SOURCES = 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/loader.c kern/rescue.c kern/term.c \ disk/powerpc/ieee1275/partition.c \ util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c \ normal/cmdline.c normal/command.c normal/main.c normal/menu.c \ - util/console.c util/pupa-emu.c util/misc.c util/i386/pc/getroot.c \ + util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c \ kern/env.c -CLEANFILES += pupa-emu pupa_emu-kern_main.o pupa_emu-kern_device.o pupa_emu-kern_disk.o pupa_emu-kern_dl.o pupa_emu-kern_file.o pupa_emu-kern_fs.o pupa_emu-kern_err.o pupa_emu-kern_misc.o pupa_emu-kern_loader.o pupa_emu-kern_rescue.o pupa_emu-kern_term.o pupa_emu-disk_powerpc_ieee1275_partition.o pupa_emu-util_i386_pc_biosdisk.o pupa_emu-fs_fat.o pupa_emu-fs_ext2.o pupa_emu-normal_cmdline.o pupa_emu-normal_command.o pupa_emu-normal_main.o pupa_emu-normal_menu.o pupa_emu-util_console.o pupa_emu-util_pupa_emu.o pupa_emu-util_misc.o pupa_emu-util_i386_pc_getroot.o pupa_emu-kern_env.o -MOSTLYCLEANFILES += pupa_emu-kern_main.d pupa_emu-kern_device.d pupa_emu-kern_disk.d pupa_emu-kern_dl.d pupa_emu-kern_file.d pupa_emu-kern_fs.d pupa_emu-kern_err.d pupa_emu-kern_misc.d pupa_emu-kern_loader.d pupa_emu-kern_rescue.d pupa_emu-kern_term.d pupa_emu-disk_powerpc_ieee1275_partition.d pupa_emu-util_i386_pc_biosdisk.d pupa_emu-fs_fat.d pupa_emu-fs_ext2.d pupa_emu-normal_cmdline.d pupa_emu-normal_command.d pupa_emu-normal_main.d pupa_emu-normal_menu.d pupa_emu-util_console.d pupa_emu-util_pupa_emu.d pupa_emu-util_misc.d pupa_emu-util_i386_pc_getroot.d pupa_emu-kern_env.d +CLEANFILES += grub-emu grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-disk_powerpc_ieee1275_partition.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o grub_emu-kern_env.o +MOSTLYCLEANFILES += grub_emu-kern_main.d grub_emu-kern_device.d grub_emu-kern_disk.d grub_emu-kern_dl.d grub_emu-kern_file.d grub_emu-kern_fs.d grub_emu-kern_err.d grub_emu-kern_misc.d grub_emu-kern_loader.d grub_emu-kern_rescue.d grub_emu-kern_term.d grub_emu-disk_powerpc_ieee1275_partition.d grub_emu-util_i386_pc_biosdisk.d grub_emu-fs_fat.d grub_emu-fs_ext2.d grub_emu-normal_cmdline.d grub_emu-normal_command.d grub_emu-normal_main.d grub_emu-normal_menu.d grub_emu-util_console.d grub_emu-util_grub_emu.d grub_emu-util_misc.d grub_emu-util_i386_pc_getroot.d grub_emu-kern_env.d -pupa-emu: pupa_emu-kern_main.o pupa_emu-kern_device.o pupa_emu-kern_disk.o pupa_emu-kern_dl.o pupa_emu-kern_file.o pupa_emu-kern_fs.o pupa_emu-kern_err.o pupa_emu-kern_misc.o pupa_emu-kern_loader.o pupa_emu-kern_rescue.o pupa_emu-kern_term.o pupa_emu-disk_powerpc_ieee1275_partition.o pupa_emu-util_i386_pc_biosdisk.o pupa_emu-fs_fat.o pupa_emu-fs_ext2.o pupa_emu-normal_cmdline.o pupa_emu-normal_command.o pupa_emu-normal_main.o pupa_emu-normal_menu.o pupa_emu-util_console.o pupa_emu-util_pupa_emu.o pupa_emu-util_misc.o pupa_emu-util_i386_pc_getroot.o pupa_emu-kern_env.o - $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(pupa_emu_LDFLAGS) +grub-emu: grub_emu-kern_main.o grub_emu-kern_device.o grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o grub_emu-disk_powerpc_ieee1275_partition.o grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o grub_emu-normal_menu.o grub_emu-util_console.o grub_emu-util_grub_emu.o grub_emu-util_misc.o grub_emu-util_i386_pc_getroot.o grub_emu-kern_env.o + $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grub_emu_LDFLAGS) -pupa_emu-kern_main.o: kern/main.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_main.o: kern/main.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_main.d: kern/main.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,main\.o[ :]*,pupa_emu-kern_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_main.d: kern/main.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,main\.o[ :]*,grub_emu-kern_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_main.d +-include grub_emu-kern_main.d -pupa_emu-kern_device.o: kern/device.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_device.o: kern/device.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_device.d: kern/device.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,device\.o[ :]*,pupa_emu-kern_device.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_device.d: kern/device.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,device\.o[ :]*,grub_emu-kern_device.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_device.d +-include grub_emu-kern_device.d -pupa_emu-kern_disk.o: kern/disk.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_disk.o: kern/disk.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_disk.d: kern/disk.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,disk\.o[ :]*,pupa_emu-kern_disk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_disk.d: kern/disk.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,disk\.o[ :]*,grub_emu-kern_disk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_disk.d +-include grub_emu-kern_disk.d -pupa_emu-kern_dl.o: kern/dl.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_dl.o: kern/dl.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_dl.d: kern/dl.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,dl\.o[ :]*,pupa_emu-kern_dl.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_dl.d: kern/dl.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,dl\.o[ :]*,grub_emu-kern_dl.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_dl.d +-include grub_emu-kern_dl.d -pupa_emu-kern_file.o: kern/file.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_file.o: kern/file.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_file.d: kern/file.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,file\.o[ :]*,pupa_emu-kern_file.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_file.d: kern/file.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,file\.o[ :]*,grub_emu-kern_file.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_file.d +-include grub_emu-kern_file.d -pupa_emu-kern_fs.o: kern/fs.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_fs.o: kern/fs.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_fs.d: kern/fs.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,fs\.o[ :]*,pupa_emu-kern_fs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_fs.d: kern/fs.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,fs\.o[ :]*,grub_emu-kern_fs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_fs.d +-include grub_emu-kern_fs.d -pupa_emu-kern_err.o: kern/err.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_err.o: kern/err.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_err.d: kern/err.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,err\.o[ :]*,pupa_emu-kern_err.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_err.d: kern/err.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,err\.o[ :]*,grub_emu-kern_err.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_err.d +-include grub_emu-kern_err.d -pupa_emu-kern_misc.o: kern/misc.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_misc.o: kern/misc.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_misc.d: kern/misc.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,misc\.o[ :]*,pupa_emu-kern_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_misc.d: kern/misc.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,misc\.o[ :]*,grub_emu-kern_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_misc.d +-include grub_emu-kern_misc.d -pupa_emu-kern_loader.o: kern/loader.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_loader.o: kern/loader.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_loader.d: kern/loader.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,loader\.o[ :]*,pupa_emu-kern_loader.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_loader.d: kern/loader.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,loader\.o[ :]*,grub_emu-kern_loader.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_loader.d +-include grub_emu-kern_loader.d -pupa_emu-kern_rescue.o: kern/rescue.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_rescue.o: kern/rescue.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_rescue.d: kern/rescue.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,rescue\.o[ :]*,pupa_emu-kern_rescue.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_rescue.d: kern/rescue.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,rescue\.o[ :]*,grub_emu-kern_rescue.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_rescue.d +-include grub_emu-kern_rescue.d -pupa_emu-kern_term.o: kern/term.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_term.o: kern/term.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_term.d: kern/term.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,term\.o[ :]*,pupa_emu-kern_term.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_term.d: kern/term.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,term\.o[ :]*,grub_emu-kern_term.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_term.d +-include grub_emu-kern_term.d -pupa_emu-disk_powerpc_ieee1275_partition.o: disk/powerpc/ieee1275/partition.c - $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-disk_powerpc_ieee1275_partition.o: disk/powerpc/ieee1275/partition.c + $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-disk_powerpc_ieee1275_partition.d: disk/powerpc/ieee1275/partition.c - set -e; $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,partition\.o[ :]*,pupa_emu-disk_powerpc_ieee1275_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-disk_powerpc_ieee1275_partition.d: disk/powerpc/ieee1275/partition.c + set -e; $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,partition\.o[ :]*,grub_emu-disk_powerpc_ieee1275_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-disk_powerpc_ieee1275_partition.d +-include grub_emu-disk_powerpc_ieee1275_partition.d -pupa_emu-util_i386_pc_biosdisk.o: util/i386/pc/biosdisk.c - $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-util_i386_pc_biosdisk.o: util/i386/pc/biosdisk.c + $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-util_i386_pc_biosdisk.d: util/i386/pc/biosdisk.c - set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,biosdisk\.o[ :]*,pupa_emu-util_i386_pc_biosdisk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-util_i386_pc_biosdisk.d: util/i386/pc/biosdisk.c + set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,biosdisk\.o[ :]*,grub_emu-util_i386_pc_biosdisk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-util_i386_pc_biosdisk.d +-include grub_emu-util_i386_pc_biosdisk.d -pupa_emu-fs_fat.o: fs/fat.c - $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-fs_fat.o: fs/fat.c + $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-fs_fat.d: fs/fat.c - set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,fat\.o[ :]*,pupa_emu-fs_fat.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-fs_fat.d: fs/fat.c + set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,fat\.o[ :]*,grub_emu-fs_fat.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-fs_fat.d +-include grub_emu-fs_fat.d -pupa_emu-fs_ext2.o: fs/ext2.c - $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-fs_ext2.o: fs/ext2.c + $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-fs_ext2.d: fs/ext2.c - set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,ext2\.o[ :]*,pupa_emu-fs_ext2.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-fs_ext2.d: fs/ext2.c + set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,ext2\.o[ :]*,grub_emu-fs_ext2.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-fs_ext2.d +-include grub_emu-fs_ext2.d -pupa_emu-normal_cmdline.o: normal/cmdline.c - $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-normal_cmdline.o: normal/cmdline.c + $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-normal_cmdline.d: normal/cmdline.c - set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,cmdline\.o[ :]*,pupa_emu-normal_cmdline.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-normal_cmdline.d: normal/cmdline.c + set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,cmdline\.o[ :]*,grub_emu-normal_cmdline.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-normal_cmdline.d +-include grub_emu-normal_cmdline.d -pupa_emu-normal_command.o: normal/command.c - $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-normal_command.o: normal/command.c + $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-normal_command.d: normal/command.c - set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,command\.o[ :]*,pupa_emu-normal_command.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-normal_command.d: normal/command.c + set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,command\.o[ :]*,grub_emu-normal_command.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-normal_command.d +-include grub_emu-normal_command.d -pupa_emu-normal_main.o: normal/main.c - $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-normal_main.o: normal/main.c + $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-normal_main.d: normal/main.c - set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,main\.o[ :]*,pupa_emu-normal_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-normal_main.d: normal/main.c + set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,main\.o[ :]*,grub_emu-normal_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-normal_main.d +-include grub_emu-normal_main.d -pupa_emu-normal_menu.o: normal/menu.c - $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-normal_menu.o: normal/menu.c + $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-normal_menu.d: normal/menu.c - set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,menu\.o[ :]*,pupa_emu-normal_menu.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-normal_menu.d: normal/menu.c + set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,menu\.o[ :]*,grub_emu-normal_menu.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-normal_menu.d +-include grub_emu-normal_menu.d -pupa_emu-util_console.o: util/console.c - $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-util_console.o: util/console.c + $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-util_console.d: util/console.c - set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,console\.o[ :]*,pupa_emu-util_console.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-util_console.d: util/console.c + set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,console\.o[ :]*,grub_emu-util_console.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-util_console.d +-include grub_emu-util_console.d -pupa_emu-util_pupa_emu.o: util/pupa-emu.c - $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-util_grub_emu.o: util/grub-emu.c + $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-util_pupa_emu.d: util/pupa-emu.c - set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,pupa\-emu\.o[ :]*,pupa_emu-util_pupa_emu.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-util_grub_emu.d: util/grub-emu.c + set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,grub\-emu\.o[ :]*,grub_emu-util_grub_emu.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-util_pupa_emu.d +-include grub_emu-util_grub_emu.d -pupa_emu-util_misc.o: util/misc.c - $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-util_misc.o: util/misc.c + $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-util_misc.d: util/misc.c - set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,misc\.o[ :]*,pupa_emu-util_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-util_misc.d: util/misc.c + set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,misc\.o[ :]*,grub_emu-util_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-util_misc.d +-include grub_emu-util_misc.d -pupa_emu-util_i386_pc_getroot.o: util/i386/pc/getroot.c - $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-util_i386_pc_getroot.o: util/i386/pc/getroot.c + $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-util_i386_pc_getroot.d: util/i386/pc/getroot.c - set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,getroot\.o[ :]*,pupa_emu-util_i386_pc_getroot.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-util_i386_pc_getroot.d: util/i386/pc/getroot.c + set -e; $(BUILD_CC) -Iutil/i386/pc -I$(srcdir)/util/i386/pc $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,getroot\.o[ :]*,grub_emu-util_i386_pc_getroot.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-util_i386_pc_getroot.d +-include grub_emu-util_i386_pc_getroot.d -pupa_emu-kern_env.o: kern/env.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -c -o $@ $< +grub_emu-kern_env.o: kern/env.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -c -o $@ $< -pupa_emu-kern_env.d: kern/env.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupa_emu_CFLAGS) -M $< | sed 's,env\.o[ :]*,pupa_emu-kern_env.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grub_emu-kern_env.d: kern/env.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grub_emu_CFLAGS) -M $< | sed 's,env\.o[ :]*,grub_emu-kern_env.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupa_emu-kern_env.d +-include grub_emu-kern_env.d -pupa_emu_LDFLAGS = -lncurses +grub_emu_LDFLAGS = -lncurses -pupaof_SOURCES = boot/powerpc/ieee1275/cmain.c boot/powerpc/ieee1275/ieee1275.c \ +grubof_SOURCES = boot/powerpc/ieee1275/cmain.c boot/powerpc/ieee1275/ieee1275.c \ boot/powerpc/ieee1275/crt0.S 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/loader.c kern/rescue.c kern/term.c \ @@ -238,232 +238,232 @@ pupaof_SOURCES = boot/powerpc/ieee1275/cmain.c boot/powerpc/ieee1275/ieee1275.c normal/command.c normal/main.c normal/menu.c \ disk/powerpc/ieee1275/ofdisk.c disk/powerpc/ieee1275/partition.c \ kern/env.c normal/arg.c -CLEANFILES += pupaof pupaof-boot_powerpc_ieee1275_cmain.o pupaof-boot_powerpc_ieee1275_ieee1275.o pupaof-boot_powerpc_ieee1275_crt0.o pupaof-kern_main.o pupaof-kern_device.o pupaof-kern_disk.o pupaof-kern_dl.o pupaof-kern_file.o pupaof-kern_fs.o pupaof-kern_err.o pupaof-kern_misc.o pupaof-kern_mm.o pupaof-kern_loader.o pupaof-kern_rescue.o pupaof-kern_term.o pupaof-kern_powerpc_ieee1275_init.o pupaof-term_powerpc_ieee1275_ofconsole.o pupaof-kern_powerpc_ieee1275_openfw.o pupaof-fs_ext2.o pupaof-normal_cmdline.o pupaof-normal_command.o pupaof-normal_main.o pupaof-normal_menu.o pupaof-disk_powerpc_ieee1275_ofdisk.o pupaof-disk_powerpc_ieee1275_partition.o pupaof-kern_env.o pupaof-normal_arg.o -MOSTLYCLEANFILES += pupaof-boot_powerpc_ieee1275_cmain.d pupaof-boot_powerpc_ieee1275_ieee1275.d pupaof-boot_powerpc_ieee1275_crt0.d pupaof-kern_main.d pupaof-kern_device.d pupaof-kern_disk.d pupaof-kern_dl.d pupaof-kern_file.d pupaof-kern_fs.d pupaof-kern_err.d pupaof-kern_misc.d pupaof-kern_mm.d pupaof-kern_loader.d pupaof-kern_rescue.d pupaof-kern_term.d pupaof-kern_powerpc_ieee1275_init.d pupaof-term_powerpc_ieee1275_ofconsole.d pupaof-kern_powerpc_ieee1275_openfw.d pupaof-fs_ext2.d pupaof-normal_cmdline.d pupaof-normal_command.d pupaof-normal_main.d pupaof-normal_menu.d pupaof-disk_powerpc_ieee1275_ofdisk.d pupaof-disk_powerpc_ieee1275_partition.d pupaof-kern_env.d pupaof-normal_arg.d +CLEANFILES += grubof grubof-boot_powerpc_ieee1275_cmain.o grubof-boot_powerpc_ieee1275_ieee1275.o grubof-boot_powerpc_ieee1275_crt0.o grubof-kern_main.o grubof-kern_device.o grubof-kern_disk.o grubof-kern_dl.o grubof-kern_file.o grubof-kern_fs.o grubof-kern_err.o grubof-kern_misc.o grubof-kern_mm.o grubof-kern_loader.o grubof-kern_rescue.o grubof-kern_term.o grubof-kern_powerpc_ieee1275_init.o grubof-term_powerpc_ieee1275_ofconsole.o grubof-kern_powerpc_ieee1275_openfw.o grubof-fs_ext2.o grubof-normal_cmdline.o grubof-normal_command.o grubof-normal_main.o grubof-normal_menu.o grubof-disk_powerpc_ieee1275_ofdisk.o grubof-disk_powerpc_ieee1275_partition.o grubof-kern_env.o grubof-normal_arg.o +MOSTLYCLEANFILES += grubof-boot_powerpc_ieee1275_cmain.d grubof-boot_powerpc_ieee1275_ieee1275.d grubof-boot_powerpc_ieee1275_crt0.d grubof-kern_main.d grubof-kern_device.d grubof-kern_disk.d grubof-kern_dl.d grubof-kern_file.d grubof-kern_fs.d grubof-kern_err.d grubof-kern_misc.d grubof-kern_mm.d grubof-kern_loader.d grubof-kern_rescue.d grubof-kern_term.d grubof-kern_powerpc_ieee1275_init.d grubof-term_powerpc_ieee1275_ofconsole.d grubof-kern_powerpc_ieee1275_openfw.d grubof-fs_ext2.d grubof-normal_cmdline.d grubof-normal_command.d grubof-normal_main.d grubof-normal_menu.d grubof-disk_powerpc_ieee1275_ofdisk.d grubof-disk_powerpc_ieee1275_partition.d grubof-kern_env.d grubof-normal_arg.d -pupaof: pupaof-boot_powerpc_ieee1275_cmain.o pupaof-boot_powerpc_ieee1275_ieee1275.o pupaof-boot_powerpc_ieee1275_crt0.o pupaof-kern_main.o pupaof-kern_device.o pupaof-kern_disk.o pupaof-kern_dl.o pupaof-kern_file.o pupaof-kern_fs.o pupaof-kern_err.o pupaof-kern_misc.o pupaof-kern_mm.o pupaof-kern_loader.o pupaof-kern_rescue.o pupaof-kern_term.o pupaof-kern_powerpc_ieee1275_init.o pupaof-term_powerpc_ieee1275_ofconsole.o pupaof-kern_powerpc_ieee1275_openfw.o pupaof-fs_ext2.o pupaof-normal_cmdline.o pupaof-normal_command.o pupaof-normal_main.o pupaof-normal_menu.o pupaof-disk_powerpc_ieee1275_ofdisk.o pupaof-disk_powerpc_ieee1275_partition.o pupaof-kern_env.o pupaof-normal_arg.o - $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(pupaof_LDFLAGS) +grubof: grubof-boot_powerpc_ieee1275_cmain.o grubof-boot_powerpc_ieee1275_ieee1275.o grubof-boot_powerpc_ieee1275_crt0.o grubof-kern_main.o grubof-kern_device.o grubof-kern_disk.o grubof-kern_dl.o grubof-kern_file.o grubof-kern_fs.o grubof-kern_err.o grubof-kern_misc.o grubof-kern_mm.o grubof-kern_loader.o grubof-kern_rescue.o grubof-kern_term.o grubof-kern_powerpc_ieee1275_init.o grubof-term_powerpc_ieee1275_ofconsole.o grubof-kern_powerpc_ieee1275_openfw.o grubof-fs_ext2.o grubof-normal_cmdline.o grubof-normal_command.o grubof-normal_main.o grubof-normal_menu.o grubof-disk_powerpc_ieee1275_ofdisk.o grubof-disk_powerpc_ieee1275_partition.o grubof-kern_env.o grubof-normal_arg.o + $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(grubof_LDFLAGS) -pupaof-boot_powerpc_ieee1275_cmain.o: boot/powerpc/ieee1275/cmain.c - $(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-boot_powerpc_ieee1275_cmain.o: boot/powerpc/ieee1275/cmain.c + $(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-boot_powerpc_ieee1275_cmain.d: boot/powerpc/ieee1275/cmain.c - set -e; $(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,cmain\.o[ :]*,pupaof-boot_powerpc_ieee1275_cmain.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-boot_powerpc_ieee1275_cmain.d: boot/powerpc/ieee1275/cmain.c + set -e; $(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,cmain\.o[ :]*,grubof-boot_powerpc_ieee1275_cmain.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-boot_powerpc_ieee1275_cmain.d +-include grubof-boot_powerpc_ieee1275_cmain.d -pupaof-boot_powerpc_ieee1275_ieee1275.o: boot/powerpc/ieee1275/ieee1275.c - $(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-boot_powerpc_ieee1275_ieee1275.o: boot/powerpc/ieee1275/ieee1275.c + $(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-boot_powerpc_ieee1275_ieee1275.d: boot/powerpc/ieee1275/ieee1275.c - set -e; $(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,ieee1275\.o[ :]*,pupaof-boot_powerpc_ieee1275_ieee1275.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-boot_powerpc_ieee1275_ieee1275.d: boot/powerpc/ieee1275/ieee1275.c + set -e; $(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,ieee1275\.o[ :]*,grubof-boot_powerpc_ieee1275_ieee1275.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-boot_powerpc_ieee1275_ieee1275.d +-include grubof-boot_powerpc_ieee1275_ieee1275.d -pupaof-boot_powerpc_ieee1275_crt0.o: boot/powerpc/ieee1275/crt0.S - $(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-boot_powerpc_ieee1275_crt0.o: boot/powerpc/ieee1275/crt0.S + $(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-boot_powerpc_ieee1275_crt0.d: boot/powerpc/ieee1275/crt0.S - set -e; $(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,crt0\.o[ :]*,pupaof-boot_powerpc_ieee1275_crt0.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-boot_powerpc_ieee1275_crt0.d: boot/powerpc/ieee1275/crt0.S + set -e; $(BUILD_CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,crt0\.o[ :]*,grubof-boot_powerpc_ieee1275_crt0.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-boot_powerpc_ieee1275_crt0.d +-include grubof-boot_powerpc_ieee1275_crt0.d -pupaof-kern_main.o: kern/main.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-kern_main.o: kern/main.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-kern_main.d: kern/main.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,main\.o[ :]*,pupaof-kern_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-kern_main.d: kern/main.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,main\.o[ :]*,grubof-kern_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-kern_main.d +-include grubof-kern_main.d -pupaof-kern_device.o: kern/device.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-kern_device.o: kern/device.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-kern_device.d: kern/device.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,device\.o[ :]*,pupaof-kern_device.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-kern_device.d: kern/device.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,device\.o[ :]*,grubof-kern_device.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-kern_device.d +-include grubof-kern_device.d -pupaof-kern_disk.o: kern/disk.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-kern_disk.o: kern/disk.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-kern_disk.d: kern/disk.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,disk\.o[ :]*,pupaof-kern_disk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-kern_disk.d: kern/disk.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,disk\.o[ :]*,grubof-kern_disk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-kern_disk.d +-include grubof-kern_disk.d -pupaof-kern_dl.o: kern/dl.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-kern_dl.o: kern/dl.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-kern_dl.d: kern/dl.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,dl\.o[ :]*,pupaof-kern_dl.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-kern_dl.d: kern/dl.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,dl\.o[ :]*,grubof-kern_dl.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-kern_dl.d +-include grubof-kern_dl.d -pupaof-kern_file.o: kern/file.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-kern_file.o: kern/file.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-kern_file.d: kern/file.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,file\.o[ :]*,pupaof-kern_file.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-kern_file.d: kern/file.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,file\.o[ :]*,grubof-kern_file.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-kern_file.d +-include grubof-kern_file.d -pupaof-kern_fs.o: kern/fs.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-kern_fs.o: kern/fs.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-kern_fs.d: kern/fs.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,fs\.o[ :]*,pupaof-kern_fs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-kern_fs.d: kern/fs.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,fs\.o[ :]*,grubof-kern_fs.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-kern_fs.d +-include grubof-kern_fs.d -pupaof-kern_err.o: kern/err.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-kern_err.o: kern/err.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-kern_err.d: kern/err.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,err\.o[ :]*,pupaof-kern_err.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-kern_err.d: kern/err.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,err\.o[ :]*,grubof-kern_err.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-kern_err.d +-include grubof-kern_err.d -pupaof-kern_misc.o: kern/misc.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-kern_misc.o: kern/misc.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-kern_misc.d: kern/misc.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,misc\.o[ :]*,pupaof-kern_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-kern_misc.d: kern/misc.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,misc\.o[ :]*,grubof-kern_misc.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-kern_misc.d +-include grubof-kern_misc.d -pupaof-kern_mm.o: kern/mm.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-kern_mm.o: kern/mm.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-kern_mm.d: kern/mm.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,mm\.o[ :]*,pupaof-kern_mm.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-kern_mm.d: kern/mm.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,mm\.o[ :]*,grubof-kern_mm.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-kern_mm.d +-include grubof-kern_mm.d -pupaof-kern_loader.o: kern/loader.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-kern_loader.o: kern/loader.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-kern_loader.d: kern/loader.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,loader\.o[ :]*,pupaof-kern_loader.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-kern_loader.d: kern/loader.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,loader\.o[ :]*,grubof-kern_loader.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-kern_loader.d +-include grubof-kern_loader.d -pupaof-kern_rescue.o: kern/rescue.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-kern_rescue.o: kern/rescue.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-kern_rescue.d: kern/rescue.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,rescue\.o[ :]*,pupaof-kern_rescue.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-kern_rescue.d: kern/rescue.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,rescue\.o[ :]*,grubof-kern_rescue.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-kern_rescue.d +-include grubof-kern_rescue.d -pupaof-kern_term.o: kern/term.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-kern_term.o: kern/term.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-kern_term.d: kern/term.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,term\.o[ :]*,pupaof-kern_term.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-kern_term.d: kern/term.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,term\.o[ :]*,grubof-kern_term.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-kern_term.d +-include grubof-kern_term.d -pupaof-kern_powerpc_ieee1275_init.o: kern/powerpc/ieee1275/init.c - $(BUILD_CC) -Ikern/powerpc/ieee1275 -I$(srcdir)/kern/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-kern_powerpc_ieee1275_init.o: kern/powerpc/ieee1275/init.c + $(BUILD_CC) -Ikern/powerpc/ieee1275 -I$(srcdir)/kern/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-kern_powerpc_ieee1275_init.d: kern/powerpc/ieee1275/init.c - set -e; $(BUILD_CC) -Ikern/powerpc/ieee1275 -I$(srcdir)/kern/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,init\.o[ :]*,pupaof-kern_powerpc_ieee1275_init.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-kern_powerpc_ieee1275_init.d: kern/powerpc/ieee1275/init.c + set -e; $(BUILD_CC) -Ikern/powerpc/ieee1275 -I$(srcdir)/kern/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,init\.o[ :]*,grubof-kern_powerpc_ieee1275_init.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-kern_powerpc_ieee1275_init.d +-include grubof-kern_powerpc_ieee1275_init.d -pupaof-term_powerpc_ieee1275_ofconsole.o: term/powerpc/ieee1275/ofconsole.c - $(BUILD_CC) -Iterm/powerpc/ieee1275 -I$(srcdir)/term/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-term_powerpc_ieee1275_ofconsole.o: term/powerpc/ieee1275/ofconsole.c + $(BUILD_CC) -Iterm/powerpc/ieee1275 -I$(srcdir)/term/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-term_powerpc_ieee1275_ofconsole.d: term/powerpc/ieee1275/ofconsole.c - set -e; $(BUILD_CC) -Iterm/powerpc/ieee1275 -I$(srcdir)/term/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,ofconsole\.o[ :]*,pupaof-term_powerpc_ieee1275_ofconsole.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-term_powerpc_ieee1275_ofconsole.d: term/powerpc/ieee1275/ofconsole.c + set -e; $(BUILD_CC) -Iterm/powerpc/ieee1275 -I$(srcdir)/term/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,ofconsole\.o[ :]*,grubof-term_powerpc_ieee1275_ofconsole.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-term_powerpc_ieee1275_ofconsole.d +-include grubof-term_powerpc_ieee1275_ofconsole.d -pupaof-kern_powerpc_ieee1275_openfw.o: kern/powerpc/ieee1275/openfw.c - $(BUILD_CC) -Ikern/powerpc/ieee1275 -I$(srcdir)/kern/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-kern_powerpc_ieee1275_openfw.o: kern/powerpc/ieee1275/openfw.c + $(BUILD_CC) -Ikern/powerpc/ieee1275 -I$(srcdir)/kern/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-kern_powerpc_ieee1275_openfw.d: kern/powerpc/ieee1275/openfw.c - set -e; $(BUILD_CC) -Ikern/powerpc/ieee1275 -I$(srcdir)/kern/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,openfw\.o[ :]*,pupaof-kern_powerpc_ieee1275_openfw.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-kern_powerpc_ieee1275_openfw.d: kern/powerpc/ieee1275/openfw.c + set -e; $(BUILD_CC) -Ikern/powerpc/ieee1275 -I$(srcdir)/kern/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,openfw\.o[ :]*,grubof-kern_powerpc_ieee1275_openfw.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-kern_powerpc_ieee1275_openfw.d +-include grubof-kern_powerpc_ieee1275_openfw.d -pupaof-fs_ext2.o: fs/ext2.c - $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-fs_ext2.o: fs/ext2.c + $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-fs_ext2.d: fs/ext2.c - set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,ext2\.o[ :]*,pupaof-fs_ext2.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-fs_ext2.d: fs/ext2.c + set -e; $(BUILD_CC) -Ifs -I$(srcdir)/fs $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,ext2\.o[ :]*,grubof-fs_ext2.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-fs_ext2.d +-include grubof-fs_ext2.d -pupaof-normal_cmdline.o: normal/cmdline.c - $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-normal_cmdline.o: normal/cmdline.c + $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-normal_cmdline.d: normal/cmdline.c - set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,cmdline\.o[ :]*,pupaof-normal_cmdline.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-normal_cmdline.d: normal/cmdline.c + set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,cmdline\.o[ :]*,grubof-normal_cmdline.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-normal_cmdline.d +-include grubof-normal_cmdline.d -pupaof-normal_command.o: normal/command.c - $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-normal_command.o: normal/command.c + $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-normal_command.d: normal/command.c - set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,command\.o[ :]*,pupaof-normal_command.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-normal_command.d: normal/command.c + set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,command\.o[ :]*,grubof-normal_command.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-normal_command.d +-include grubof-normal_command.d -pupaof-normal_main.o: normal/main.c - $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-normal_main.o: normal/main.c + $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-normal_main.d: normal/main.c - set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,main\.o[ :]*,pupaof-normal_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-normal_main.d: normal/main.c + set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,main\.o[ :]*,grubof-normal_main.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-normal_main.d +-include grubof-normal_main.d -pupaof-normal_menu.o: normal/menu.c - $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-normal_menu.o: normal/menu.c + $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-normal_menu.d: normal/menu.c - set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,menu\.o[ :]*,pupaof-normal_menu.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-normal_menu.d: normal/menu.c + set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,menu\.o[ :]*,grubof-normal_menu.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-normal_menu.d +-include grubof-normal_menu.d -pupaof-disk_powerpc_ieee1275_ofdisk.o: disk/powerpc/ieee1275/ofdisk.c - $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-disk_powerpc_ieee1275_ofdisk.o: disk/powerpc/ieee1275/ofdisk.c + $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-disk_powerpc_ieee1275_ofdisk.d: disk/powerpc/ieee1275/ofdisk.c - set -e; $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,ofdisk\.o[ :]*,pupaof-disk_powerpc_ieee1275_ofdisk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-disk_powerpc_ieee1275_ofdisk.d: disk/powerpc/ieee1275/ofdisk.c + set -e; $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,ofdisk\.o[ :]*,grubof-disk_powerpc_ieee1275_ofdisk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-disk_powerpc_ieee1275_ofdisk.d +-include grubof-disk_powerpc_ieee1275_ofdisk.d -pupaof-disk_powerpc_ieee1275_partition.o: disk/powerpc/ieee1275/partition.c - $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-disk_powerpc_ieee1275_partition.o: disk/powerpc/ieee1275/partition.c + $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-disk_powerpc_ieee1275_partition.d: disk/powerpc/ieee1275/partition.c - set -e; $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,partition\.o[ :]*,pupaof-disk_powerpc_ieee1275_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-disk_powerpc_ieee1275_partition.d: disk/powerpc/ieee1275/partition.c + set -e; $(BUILD_CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,partition\.o[ :]*,grubof-disk_powerpc_ieee1275_partition.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-disk_powerpc_ieee1275_partition.d +-include grubof-disk_powerpc_ieee1275_partition.d -pupaof-kern_env.o: kern/env.c - $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-kern_env.o: kern/env.c + $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-kern_env.d: kern/env.c - set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,env\.o[ :]*,pupaof-kern_env.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-kern_env.d: kern/env.c + set -e; $(BUILD_CC) -Ikern -I$(srcdir)/kern $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,env\.o[ :]*,grubof-kern_env.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-kern_env.d +-include grubof-kern_env.d -pupaof-normal_arg.o: normal/arg.c - $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -c -o $@ $< +grubof-normal_arg.o: normal/arg.c + $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -c -o $@ $< -pupaof-normal_arg.d: normal/arg.c - set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(pupaof_CFLAGS) -M $< | sed 's,arg\.o[ :]*,pupaof-normal_arg.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-normal_arg.d: normal/arg.c + set -e; $(BUILD_CC) -Inormal -I$(srcdir)/normal $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(grubof_CFLAGS) -M $< | sed 's,arg\.o[ :]*,grubof-normal_arg.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include pupaof-normal_arg.d +-include grubof-normal_arg.d -pupaof_HEADERS = pupa/powerpc/ieee1275/ieee1275.h -pupaof_CFLAGS = $(COMMON_CFLAGS) -pupaof_ASFLAGS = $(COMMON_ASFLAGS) -pupaof_LDFLAGS = -Wl,-Ttext,0x200000,-Bstatic +grubof_HEADERS = grub/powerpc/ieee1275/ieee1275.h +grubof_CFLAGS = $(COMMON_CFLAGS) +grubof_ASFLAGS = $(COMMON_ASFLAGS) +grubof_LDFLAGS = -Wl,-Ttext,0x200000,-Bstatic # For genmoddep. genmoddep_SOURCES = util/genmoddep.c @@ -474,10 +474,10 @@ genmoddep: genmoddep-util_genmoddep.o $(BUILD_CC) -o $@ $^ $(BUILD_LDFLAGS) $(genmoddep_LDFLAGS) genmoddep-util_genmoddep.o: util/genmoddep.c - $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(genmoddep_CFLAGS) -c -o $@ $< + $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(genmoddep_CFLAGS) -c -o $@ $< genmoddep-util_genmoddep.d: util/genmoddep.c - set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(genmoddep_CFLAGS) -M $< | sed 's,genmoddep\.o[ :]*,genmoddep-util_genmoddep.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + set -e; $(BUILD_CC) -Iutil -I$(srcdir)/util $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(genmoddep_CFLAGS) -M $< | sed 's,genmoddep\.o[ :]*,genmoddep-util_genmoddep.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ -include genmoddep-util_genmoddep.d diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk index ac63dec38..e22d07284 100644 --- a/conf/powerpc-ieee1275.rmk +++ b/conf/powerpc-ieee1275.rmk @@ -9,29 +9,29 @@ COMMON_CFLAGS = -fno-builtin -D__ASSEMBLY__ MOSTLYCLEANFILES += symlist.c kernel_syms.lst DEFSYMFILES += kernel_syms.lst -symlist.c: $(addprefix include/pupa/,$(kernel_img_HEADERS)) gensymlist.sh +symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) gensymlist.sh sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@ -kernel_syms.lst: $(addprefix include/pupa/,$(kernel_img_HEADERS)) genkernsyms.sh +kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) genkernsyms.sh sh $(srcdir)/genkernsyms.sh $(filter %h,$^) > $@ # Utilities. -sbin_UTILITIES = pupaof -bin_UTILITIES = pupa-emu +sbin_UTILITIES = grubof +bin_UTILITIES = grub-emu noinst_UTILITIES = genmoddep -# For pupa-emu -pupa_emu_SOURCES = kern/main.c kern/device.c \ +# For grub-emu +grub_emu_SOURCES = 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/loader.c kern/rescue.c kern/term.c \ disk/powerpc/ieee1275/partition.c \ util/i386/pc/biosdisk.c fs/fat.c fs/ext2.c \ normal/cmdline.c normal/command.c normal/main.c normal/menu.c \ - util/console.c util/pupa-emu.c util/misc.c util/i386/pc/getroot.c \ + util/console.c util/grub-emu.c util/misc.c util/i386/pc/getroot.c \ kern/env.c -pupa_emu_LDFLAGS = -lncurses +grub_emu_LDFLAGS = -lncurses -pupaof_SOURCES = boot/powerpc/ieee1275/cmain.c boot/powerpc/ieee1275/ieee1275.c \ +grubof_SOURCES = boot/powerpc/ieee1275/cmain.c boot/powerpc/ieee1275/ieee1275.c \ boot/powerpc/ieee1275/crt0.S 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/loader.c kern/rescue.c kern/term.c \ @@ -40,10 +40,10 @@ pupaof_SOURCES = boot/powerpc/ieee1275/cmain.c boot/powerpc/ieee1275/ieee1275.c normal/command.c normal/main.c normal/menu.c \ disk/powerpc/ieee1275/ofdisk.c disk/powerpc/ieee1275/partition.c \ kern/env.c normal/arg.c -pupaof_HEADERS = pupa/powerpc/ieee1275/ieee1275.h -pupaof_CFLAGS = $(COMMON_CFLAGS) -pupaof_ASFLAGS = $(COMMON_ASFLAGS) -pupaof_LDFLAGS = -Wl,-Ttext,0x200000,-Bstatic +grubof_HEADERS = grub/powerpc/ieee1275/ieee1275.h +grubof_CFLAGS = $(COMMON_CFLAGS) +grubof_ASFLAGS = $(COMMON_ASFLAGS) +grubof_LDFLAGS = -Wl,-Ttext,0x200000,-Bstatic # For genmoddep. genmoddep_SOURCES = util/genmoddep.c diff --git a/configure b/configure index 49c04d411..8983f6ad5 100644 --- a/configure +++ b/configure @@ -272,7 +272,7 @@ PACKAGE_VERSION='1.90' PACKAGE_STRING='GRUB 1.90' PACKAGE_BUGREPORT='bug-grub@gnu.org' -ac_unique_file="include/pupa/dl.h" +ac_unique_file="include/grub/dl.h" # Factoring default headers for most tests. ac_includes_default="\ #include @@ -2693,7 +2693,7 @@ fi echo "$as_me:$LINENO: checking if C symbols get an underscore after compilation" >&5 echo $ECHO_N "checking if C symbols get an underscore after compilation... $ECHO_C" >&6 -if test "${pupa_cv_asm_uscore+set}" = set; then +if test "${grub_cv_asm_uscore+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat > conftest.c <<\EOF @@ -2719,31 +2719,31 @@ echo "$as_me: error: ${CC-cc} failed to produce assembly code" >&2;} fi if grep _func conftest.s >/dev/null 2>&1; then - pupa_cv_asm_uscore=yes + grub_cv_asm_uscore=yes else - pupa_cv_asm_uscore=no + grub_cv_asm_uscore=no fi rm -f conftest* fi -if test "x$pupa_cv_asm_uscore" = xyes; then +if test "x$grub_cv_asm_uscore" = xyes; then cat >>confdefs.h <<_ACEOF -#define HAVE_ASM_USCORE $pupa_cv_asm_uscore +#define HAVE_ASM_USCORE $grub_cv_asm_uscore _ACEOF fi -echo "$as_me:$LINENO: result: $pupa_cv_asm_uscore" >&5 -echo "${ECHO_T}$pupa_cv_asm_uscore" >&6 +echo "$as_me:$LINENO: result: $grub_cv_asm_uscore" >&5 +echo "${ECHO_T}$grub_cv_asm_uscore" >&6 if test "x$host_cpu" = xi386; then echo "$as_me:$LINENO: checking if start is defined by the compiler" >&5 echo $ECHO_N "checking if start is defined by the compiler... $ECHO_C" >&6 -if test "${pupa_cv_check_start_symbol+set}" = set; then +if test "${grub_cv_check_start_symbol+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -2774,23 +2774,23 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - pupa_cv_check_start_symbol=yes + grub_cv_check_start_symbol=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -pupa_cv_check_start_symbol=no +grub_cv_check_start_symbol=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $pupa_cv_check_start_symbol" >&5 -echo "${ECHO_T}$pupa_cv_check_start_symbol" >&6 +echo "$as_me:$LINENO: result: $grub_cv_check_start_symbol" >&5 +echo "${ECHO_T}$grub_cv_check_start_symbol" >&6 echo "$as_me:$LINENO: checking if _start is defined by the compiler" >&5 echo $ECHO_N "checking if _start is defined by the compiler... $ECHO_C" >&6 -if test "${pupa_cv_check_uscore_start_symbol+set}" = set; then +if test "${grub_cv_check_uscore_start_symbol+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -2821,29 +2821,29 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - pupa_cv_check_uscore_start_symbol=yes + grub_cv_check_uscore_start_symbol=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -pupa_cv_check_uscore_start_symbol=no +grub_cv_check_uscore_start_symbol=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $pupa_cv_check_uscore_start_symbol" >&5 -echo "${ECHO_T}$pupa_cv_check_uscore_start_symbol" >&6 +echo "$as_me:$LINENO: result: $grub_cv_check_uscore_start_symbol" >&5 +echo "${ECHO_T}$grub_cv_check_uscore_start_symbol" >&6 -if test "x$pupa_cv_check_start_symbol" = xyes; then +if test "x$grub_cv_check_start_symbol" = xyes; then cat >>confdefs.h <<\_ACEOF #define START_SYMBOL start _ACEOF -elif test "x$pupa_cv_check_uscore_start_symbol" = xyes; then +elif test "x$grub_cv_check_uscore_start_symbol" = xyes; then cat >>confdefs.h <<\_ACEOF #define START_SYMBOL _start _ACEOF @@ -2857,7 +2857,7 @@ fi echo "$as_me:$LINENO: checking if __bss_start is defined by the compiler" >&5 echo $ECHO_N "checking if __bss_start is defined by the compiler... $ECHO_C" >&6 -if test "${pupa_cv_check_uscore_uscore_bss_start_symbol+set}" = set; then +if test "${grub_cv_check_uscore_uscore_bss_start_symbol+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -2888,23 +2888,23 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - pupa_cv_check_uscore_uscore_bss_start_symbol=yes + grub_cv_check_uscore_uscore_bss_start_symbol=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -pupa_cv_check_uscore_uscore_bss_start_symbol=no +grub_cv_check_uscore_uscore_bss_start_symbol=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $pupa_cv_check_uscore_uscore_bss_start_symbol" >&5 -echo "${ECHO_T}$pupa_cv_check_uscore_uscore_bss_start_symbol" >&6 +echo "$as_me:$LINENO: result: $grub_cv_check_uscore_uscore_bss_start_symbol" >&5 +echo "${ECHO_T}$grub_cv_check_uscore_uscore_bss_start_symbol" >&6 echo "$as_me:$LINENO: checking if edata is defined by the compiler" >&5 echo $ECHO_N "checking if edata is defined by the compiler... $ECHO_C" >&6 -if test "${pupa_cv_check_edata_symbol+set}" = set; then +if test "${grub_cv_check_edata_symbol+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -2935,23 +2935,23 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - pupa_cv_check_edata_symbol=yes + grub_cv_check_edata_symbol=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -pupa_cv_check_edata_symbol=no +grub_cv_check_edata_symbol=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $pupa_cv_check_edata_symbol" >&5 -echo "${ECHO_T}$pupa_cv_check_edata_symbol" >&6 +echo "$as_me:$LINENO: result: $grub_cv_check_edata_symbol" >&5 +echo "${ECHO_T}$grub_cv_check_edata_symbol" >&6 echo "$as_me:$LINENO: checking if _edata is defined by the compiler" >&5 echo $ECHO_N "checking if _edata is defined by the compiler... $ECHO_C" >&6 -if test "${pupa_cv_check_uscore_edata_symbol+set}" = set; then +if test "${grub_cv_check_uscore_edata_symbol+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -2982,34 +2982,34 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - pupa_cv_check_uscore_edata_symbol=yes + grub_cv_check_uscore_edata_symbol=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -pupa_cv_check_uscore_edata_symbol=no +grub_cv_check_uscore_edata_symbol=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $pupa_cv_check_uscore_edata_symbol" >&5 -echo "${ECHO_T}$pupa_cv_check_uscore_edata_symbol" >&6 +echo "$as_me:$LINENO: result: $grub_cv_check_uscore_edata_symbol" >&5 +echo "${ECHO_T}$grub_cv_check_uscore_edata_symbol" >&6 -if test "x$pupa_cv_check_uscore_uscore_bss_start_symbol" = xyes; then +if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" = xyes; then cat >>confdefs.h <<\_ACEOF #define BSS_START_SYMBOL __bss_start _ACEOF -elif test "x$pupa_cv_check_edata_symbol" = xyes; then +elif test "x$grub_cv_check_edata_symbol" = xyes; then cat >>confdefs.h <<\_ACEOF #define BSS_START_SYMBOL edata _ACEOF -elif test "x$pupa_cv_check_uscore_edata_symbol" = xyes; then +elif test "x$grub_cv_check_uscore_edata_symbol" = xyes; then cat >>confdefs.h <<\_ACEOF #define BSS_START_SYMBOL _edata _ACEOF @@ -3023,7 +3023,7 @@ fi echo "$as_me:$LINENO: checking if end is defined by the compiler" >&5 echo $ECHO_N "checking if end is defined by the compiler... $ECHO_C" >&6 -if test "${pupa_cv_check_end_symbol+set}" = set; then +if test "${grub_cv_check_end_symbol+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -3054,23 +3054,23 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - pupa_cv_check_end_symbol=yes + grub_cv_check_end_symbol=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -pupa_cv_check_end_symbol=no +grub_cv_check_end_symbol=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $pupa_cv_check_end_symbol" >&5 -echo "${ECHO_T}$pupa_cv_check_end_symbol" >&6 +echo "$as_me:$LINENO: result: $grub_cv_check_end_symbol" >&5 +echo "${ECHO_T}$grub_cv_check_end_symbol" >&6 echo "$as_me:$LINENO: checking if _end is defined by the compiler" >&5 echo $ECHO_N "checking if _end is defined by the compiler... $ECHO_C" >&6 -if test "${pupa_cv_check_uscore_end_symbol+set}" = set; then +if test "${grub_cv_check_uscore_end_symbol+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -3101,29 +3101,29 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - pupa_cv_check_uscore_end_symbol=yes + grub_cv_check_uscore_end_symbol=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -pupa_cv_check_uscore_end_symbol=no +grub_cv_check_uscore_end_symbol=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $pupa_cv_check_uscore_end_symbol" >&5 -echo "${ECHO_T}$pupa_cv_check_uscore_end_symbol" >&6 +echo "$as_me:$LINENO: result: $grub_cv_check_uscore_end_symbol" >&5 +echo "${ECHO_T}$grub_cv_check_uscore_end_symbol" >&6 -if test "x$pupa_cv_check_end_symbol" = xyes; then +if test "x$grub_cv_check_end_symbol" = xyes; then cat >>confdefs.h <<\_ACEOF #define END_SYMBOL end _ACEOF -elif test "x$pupa_cv_check_uscore_end_symbol" = xyes; then +elif test "x$grub_cv_check_uscore_end_symbol" = xyes; then cat >>confdefs.h <<\_ACEOF #define END_SYMBOL _end _ACEOF @@ -3140,7 +3140,7 @@ if test "x$host_cpu" = xi386; then echo "$as_me:$LINENO: checking whether addr32 must be in the same line as the instruction" >&5 echo $ECHO_N "checking whether addr32 must be in the same line as the instruction... $ECHO_C" >&6 -if test "${pupa_cv_i386_asm_prefix_requirement+set}" = set; then +if test "${grub_cv_i386_asm_prefix_requirement+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat > conftest.s <<\EOF @@ -3154,41 +3154,41 @@ if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s' ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && test -s conftest.o; then - pupa_cv_i386_asm_prefix_requirement=yes + grub_cv_i386_asm_prefix_requirement=yes else - pupa_cv_i386_asm_prefix_requirement=no + grub_cv_i386_asm_prefix_requirement=no fi rm -f conftest* fi -if test "x$pupa_cv_i386_asm_prefix_requirement" = xyes; then - pupa_tmp_addr32="addr32" - pupa_tmp_data32="data32" +if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then + grub_tmp_addr32="addr32" + grub_tmp_data32="data32" else - pupa_tmp_addr32="addr32;" - pupa_tmp_data32="data32;" + grub_tmp_addr32="addr32;" + grub_tmp_data32="data32;" fi cat >>confdefs.h <<_ACEOF -#define ADDR32 $pupa_tmp_addr32 +#define ADDR32 $grub_tmp_addr32 _ACEOF cat >>confdefs.h <<_ACEOF -#define DATA32 $pupa_tmp_data32 +#define DATA32 $grub_tmp_data32 _ACEOF -echo "$as_me:$LINENO: result: $pupa_cv_i386_asm_prefix_requirement" >&5 -echo "${ECHO_T}$pupa_cv_i386_asm_prefix_requirement" >&6 +echo "$as_me:$LINENO: result: $grub_cv_i386_asm_prefix_requirement" >&5 +echo "${ECHO_T}$grub_cv_i386_asm_prefix_requirement" >&6 echo "$as_me:$LINENO: checking for .code16 addr32 assembler support" >&5 echo $ECHO_N "checking for .code16 addr32 assembler support... $ECHO_C" >&6 -if test "${pupa_cv_i386_asm_addr32+set}" = set; then +if test "${grub_cv_i386_asm_addr32+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat > conftest.s.in <<\EOF @@ -3196,7 +3196,7 @@ else l1: @ADDR32@ movb %al, l1 EOF -if test "x$pupa_cv_i386_asm_prefix_requirement" = xyes; then +if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then sed -e s/@ADDR32@/addr32/ < conftest.s.in > conftest.s else sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s @@ -3208,21 +3208,21 @@ if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s' ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && test -s conftest.o; then - pupa_cv_i386_asm_addr32=yes + grub_cv_i386_asm_addr32=yes else - pupa_cv_i386_asm_addr32=no + grub_cv_i386_asm_addr32=no fi rm -f conftest* fi -echo "$as_me:$LINENO: result: $pupa_cv_i386_asm_addr32" >&5 -echo "${ECHO_T}$pupa_cv_i386_asm_addr32" >&6 +echo "$as_me:$LINENO: result: $grub_cv_i386_asm_addr32" >&5 +echo "${ECHO_T}$grub_cv_i386_asm_addr32" >&6 echo "$as_me:$LINENO: checking whether an absolute indirect call/jump must not be prefixed with an asterisk" >&5 echo $ECHO_N "checking whether an absolute indirect call/jump must not be prefixed with an asterisk... $ECHO_C" >&6 -if test "${pupa_cv_i386_asm_absolute_without_asterisk+set}" = set; then +if test "${grub_cv_i386_asm_absolute_without_asterisk+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat > conftest.s <<\EOF @@ -3238,16 +3238,16 @@ if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s' ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && test -s conftest.o; then - pupa_cv_i386_asm_absolute_without_asterisk=no + grub_cv_i386_asm_absolute_without_asterisk=no else - pupa_cv_i386_asm_absolute_without_asterisk=yes + grub_cv_i386_asm_absolute_without_asterisk=yes fi rm -f conftest* fi -if test "x$pupa_cv_i386_asm_absolute_without_asterisk" = xyes; then +if test "x$grub_cv_i386_asm_absolute_without_asterisk" = xyes; then cat >>confdefs.h <<\_ACEOF #define ABSOLUTE_WITHOUT_ASTERISK 1 @@ -3255,12 +3255,12 @@ _ACEOF fi -echo "$as_me:$LINENO: result: $pupa_cv_i386_asm_absolute_without_asterisk" >&5 -echo "${ECHO_T}$pupa_cv_i386_asm_absolute_without_asterisk" >&6 +echo "$as_me:$LINENO: result: $grub_cv_i386_asm_absolute_without_asterisk" >&5 +echo "${ECHO_T}$grub_cv_i386_asm_absolute_without_asterisk" >&6 echo "$as_me:$LINENO: checking if GCC has the regparm=3 bug" >&5 echo $ECHO_N "checking if GCC has the regparm=3 bug... $ECHO_C" >&6 -if test "${pupa_cv_i386_check_nested_functions+set}" = set; then +if test "${grub_cv_i386_check_nested_functions+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then @@ -3305,24 +3305,24 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - pupa_cv_i386_check_nested_functions=yes + grub_cv_i386_check_nested_functions=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -pupa_cv_i386_check_nested_functions=no +grub_cv_i386_check_nested_functions=no fi rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:$LINENO: result: $pupa_cv_i386_check_nested_functions" >&5 -echo "${ECHO_T}$pupa_cv_i386_check_nested_functions" >&6 +echo "$as_me:$LINENO: result: $grub_cv_i386_check_nested_functions" >&5 +echo "${ECHO_T}$grub_cv_i386_check_nested_functions" >&6 -if test "x$pupa_cv_i386_check_nested_functions" = xyes; then +if test "x$grub_cv_i386_check_nested_functions" = xyes; then cat >>confdefs.h <<\_ACEOF #define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (2))) @@ -3531,7 +3531,7 @@ fi echo "$as_me:$LINENO: checking whether ${OBJCOPY} works for absolute addresses" >&5 echo $ECHO_N "checking whether ${OBJCOPY} works for absolute addresses... $ECHO_C" >&6 -if test "${pupa_cv_prog_objcopy_absolute+set}" = set; then +if test "${grub_cv_prog_objcopy_absolute+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat > conftest.c <<\EOF @@ -3552,7 +3552,7 @@ else echo "$as_me: error: ${CC-cc} cannot compile C source code" >&2;} { (exit 1); exit 1; }; } fi -pupa_cv_prog_objcopy_absolute=yes +grub_cv_prog_objcopy_absolute=yes for link_addr in 2000 8000 7C00; do if { ac_try='${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 @@ -3584,19 +3584,19 @@ echo "$as_me: error: ${OBJCOPY-objcopy} cannot create binary files" >&2;} (exit $ac_status); }; }; then mv -f conftest conftest.old else - pupa_cv_prog_objcopy_absolute=no + grub_cv_prog_objcopy_absolute=no break fi done rm -f conftest* fi -echo "$as_me:$LINENO: result: $pupa_cv_prog_objcopy_absolute" >&5 -echo "${ECHO_T}$pupa_cv_prog_objcopy_absolute" >&6 +echo "$as_me:$LINENO: result: $grub_cv_prog_objcopy_absolute" >&5 +echo "${ECHO_T}$grub_cv_prog_objcopy_absolute" >&6 -if test "x$pupa_cv_prog_objcopy_absolute" = xno; then - { { echo "$as_me:$LINENO: error: PUPA requires a working absolute objcopy; upgrade your binutils" >&5 -echo "$as_me: error: PUPA requires a working absolute objcopy; upgrade your binutils" >&2;} +if test "x$grub_cv_prog_objcopy_absolute" = xno; then + { { echo "$as_me:$LINENO: error: GRUB requires a working absolute objcopy; upgrade your binutils" >&5 +echo "$as_me: error: GRUB requires a working absolute objcopy; upgrade your binutils" >&2;} { (exit 1); exit 1; }; } fi @@ -5495,7 +5495,7 @@ CFLAGS="$tmp_CFLAGS" CPPFLAGS="$tmp_CPPFLAGS" # Output files. - ac_config_links="$ac_config_links include/pupa/cpu:include/pupa/$host_cpu include/pupa/machine:include/pupa/$host_cpu/$host_vendor" + ac_config_links="$ac_config_links include/grub/cpu:include/grub/$host_cpu include/grub/machine:include/grub/$host_cpu/$host_vendor" ac_config_files="$ac_config_files Makefile" @@ -6030,8 +6030,8 @@ do # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "stamp-h" ) CONFIG_FILES="$CONFIG_FILES stamp-h" ;; - "include/pupa/cpu" ) CONFIG_LINKS="$CONFIG_LINKS include/pupa/cpu:include/pupa/$host_cpu" ;; - "include/pupa/machine" ) CONFIG_LINKS="$CONFIG_LINKS include/pupa/machine:include/pupa/$host_cpu/$host_vendor" ;; + "include/grub/cpu" ) CONFIG_LINKS="$CONFIG_LINKS include/grub/cpu:include/grub/$host_cpu" ;; + "include/grub/machine" ) CONFIG_LINKS="$CONFIG_LINKS include/grub/machine:include/grub/$host_cpu/$host_vendor" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} diff --git a/configure.ac b/configure.ac index f31aefa61..680cc706b 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ AC_INIT(GRUB, 1.90, [bug-grub@gnu.org]) AC_PREREQ(2.53) -AC_CONFIG_SRCDIR([include/pupa/dl.h]) +AC_CONFIG_SRCDIR([include/grub/dl.h]) AC_CONFIG_HEADER([config.h]) # Checks for build and host systems. @@ -81,18 +81,18 @@ fi AC_SUBST(CFLAGS) # Defined in aclocal.m4. -pupa_ASM_USCORE +grub_ASM_USCORE if test "x$host_cpu" = xi386; then - pupa_CHECK_START_SYMBOL - pupa_CHECK_BSS_START_SYMBOL - pupa_CHECK_END_SYMBOL + grub_CHECK_START_SYMBOL + grub_CHECK_BSS_START_SYMBOL + grub_CHECK_END_SYMBOL fi if test "x$host_cpu" = xi386; then - pupa_I386_ASM_PREFIX_REQUIREMENT - pupa_I386_ASM_ADDR32 - pupa_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK - pupa_I386_CHECK_REGPARM_BUG + grub_I386_ASM_PREFIX_REQUIREMENT + grub_I386_ASM_ADDR32 + grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK + grub_I386_CHECK_REGPARM_BUG else AC_DEFINE([NESTED_FUNC_ATTR], [],[Catch gcc bug]) fi @@ -100,7 +100,7 @@ fi AC_PROG_INSTALL AC_PROG_MAKE_SET AC_CHECK_TOOL(OBJCOPY, objcopy) -pupa_PROG_OBJCOPY_ABSOLUTE +grub_PROG_OBJCOPY_ABSOLUTE AC_CHECK_TOOL(STRIP, strip) AC_CHECK_TOOL(NM, nm) AC_CHECK_TOOL(LD, ld) @@ -143,8 +143,8 @@ CFLAGS="$tmp_CFLAGS" CPPFLAGS="$tmp_CPPFLAGS" # Output files. -AC_CONFIG_LINKS([include/pupa/cpu:include/pupa/$host_cpu - include/pupa/machine:include/pupa/$host_cpu/$host_vendor]) +AC_CONFIG_LINKS([include/grub/cpu:include/grub/$host_cpu + include/grub/machine:include/grub/$host_cpu/$host_vendor]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) AC_OUTPUT diff --git a/disk/i386/pc/biosdisk.c b/disk/i386/pc/biosdisk.c index 3dc34ba4d..e21d10c87 100644 --- a/disk/i386/pc/biosdisk.c +++ b/disk/i386/pc/biosdisk.c @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 1999,2000,2001,2002,2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,69 +13,69 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include /* Drive Parameters. */ -struct pupa_biosdisk_drp +struct grub_biosdisk_drp { - pupa_uint16_t size; - pupa_uint16_t flags; - pupa_uint32_t cylinders; - pupa_uint32_t heads; - pupa_uint32_t sectors; - pupa_uint64_t total_sectors; - pupa_uint16_t bytes_per_sector; + grub_uint16_t size; + grub_uint16_t flags; + grub_uint32_t cylinders; + grub_uint32_t heads; + grub_uint32_t sectors; + grub_uint64_t total_sectors; + grub_uint16_t bytes_per_sector; /* ver 2.0 or higher */ - pupa_uint32_t EDD_configuration_parameters; + grub_uint32_t EDD_configuration_parameters; /* ver 3.0 or higher */ - pupa_uint16_t signature_dpi; - pupa_uint8_t length_dpi; - pupa_uint8_t reserved[3]; - pupa_uint8_t name_of_host_bus[4]; - pupa_uint8_t name_of_interface_type[8]; - pupa_uint8_t interface_path[8]; - pupa_uint8_t device_path[8]; - pupa_uint8_t reserved2; - pupa_uint8_t checksum; + grub_uint16_t signature_dpi; + grub_uint8_t length_dpi; + grub_uint8_t reserved[3]; + grub_uint8_t name_of_host_bus[4]; + grub_uint8_t name_of_interface_type[8]; + grub_uint8_t interface_path[8]; + grub_uint8_t device_path[8]; + grub_uint8_t reserved2; + grub_uint8_t checksum; /* XXX: This is necessary, because the BIOS of Thinkpad X20 writes a garbage to the tail of drive parameters, regardless of a size specified in a caller. */ - pupa_uint8_t dummy[16]; + grub_uint8_t dummy[16]; } __attribute__ ((packed)); /* Disk Address Packet. */ -struct pupa_biosdisk_dap +struct grub_biosdisk_dap { - pupa_uint8_t length; - pupa_uint8_t reserved; - pupa_uint16_t blocks; - pupa_uint32_t buffer; - pupa_uint64_t block; + grub_uint8_t length; + grub_uint8_t reserved; + grub_uint16_t blocks; + grub_uint32_t buffer; + grub_uint64_t block; } __attribute__ ((packed)); static int -pupa_biosdisk_get_drive (const char *name) +grub_biosdisk_get_drive (const char *name) { unsigned long drive; if ((name[0] != 'f' && name[0] != 'h') || name[1] != 'd') goto fail; - drive = pupa_strtoul (name + 2, 0, 10); - if (pupa_errno != PUPA_ERR_NONE) + drive = grub_strtoul (name + 2, 0, 10); + if (grub_errno != GRUB_ERR_NONE) goto fail; if (name[0] == 'h') @@ -84,62 +84,62 @@ pupa_biosdisk_get_drive (const char *name) return (int) drive ; fail: - pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "not a biosdisk"); + grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a biosdisk"); return -1; } static int -pupa_biosdisk_call_hook (int (*hook) (const char *name), int drive) +grub_biosdisk_call_hook (int (*hook) (const char *name), int drive) { char name[10]; - pupa_sprintf (name, (drive & 0x80) ? "hd%d" : "fd%d", drive & (~0x80)); + grub_sprintf (name, (drive & 0x80) ? "hd%d" : "fd%d", drive & (~0x80)); return hook (name); } static int -pupa_biosdisk_iterate (int (*hook) (const char *name)) +grub_biosdisk_iterate (int (*hook) (const char *name)) { int drive; int num_floppies; /* For floppy disks, we can get the number safely. */ - num_floppies = pupa_biosdisk_get_num_floppies (); + num_floppies = grub_biosdisk_get_num_floppies (); for (drive = 0; drive < num_floppies; drive++) - if (pupa_biosdisk_call_hook (hook, drive)) + if (grub_biosdisk_call_hook (hook, drive)) return 1; /* For hard disks, attempt to read the MBR. */ for (drive = 0x80; drive < 0x90; drive++) { - if (pupa_biosdisk_rw_standard (0x02, drive, 0, 0, 1, 1, - PUPA_MEMORY_MACHINE_SCRATCH_SEG) != 0) + if (grub_biosdisk_rw_standard (0x02, drive, 0, 0, 1, 1, + GRUB_MEMORY_MACHINE_SCRATCH_SEG) != 0) break; - if (pupa_biosdisk_call_hook (hook, drive)) + if (grub_biosdisk_call_hook (hook, drive)) return 1; } return 0; } -static pupa_err_t -pupa_biosdisk_open (const char *name, pupa_disk_t disk) +static grub_err_t +grub_biosdisk_open (const char *name, grub_disk_t disk) { unsigned long total_sectors = 0; int drive; - struct pupa_biosdisk_data *data; + struct grub_biosdisk_data *data; - drive = pupa_biosdisk_get_drive (name); + drive = grub_biosdisk_get_drive (name); if (drive < 0) - return pupa_errno; + return grub_errno; disk->has_partitions = (drive & 0x80); disk->id = drive; - data = (struct pupa_biosdisk_data *) pupa_malloc (sizeof (*data)); + data = (struct grub_biosdisk_data *) grub_malloc (sizeof (*data)); if (! data) - return pupa_errno; + return grub_errno; data->drive = drive; data->flags = 0; @@ -149,18 +149,18 @@ pupa_biosdisk_open (const char *name, pupa_disk_t disk) /* HDD */ int version; - version = pupa_biosdisk_check_int13_extensions (drive); + version = grub_biosdisk_check_int13_extensions (drive); if (version) { - struct pupa_biosdisk_drp *drp - = (struct pupa_biosdisk_drp *) PUPA_MEMORY_MACHINE_SCRATCH_ADDR; + struct grub_biosdisk_drp *drp + = (struct grub_biosdisk_drp *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR; /* Clear out the DRP. */ - pupa_memset (drp, 0, sizeof (*drp)); + grub_memset (drp, 0, sizeof (*drp)); drp->size = sizeof (*drp); - if (!pupa_biosdisk_get_diskinfo_int13_extensions (drive, drp)) + if (!grub_biosdisk_get_diskinfo_int13_extensions (drive, drp)) { - data->flags = PUPA_BIOSDISK_FLAG_LBA; + data->flags = GRUB_BIOSDISK_FLAG_LBA; /* FIXME: 2TB limit. */ if (drp->total_sectors) @@ -174,13 +174,13 @@ pupa_biosdisk_open (const char *name, pupa_disk_t disk) } } - if (pupa_biosdisk_get_diskinfo_standard (drive, + if (grub_biosdisk_get_diskinfo_standard (drive, &data->cylinders, &data->heads, &data->sectors) != 0) { - pupa_free (data); - return pupa_error (PUPA_ERR_BAD_DEVICE, "cannot get C/H/S values"); + grub_free (data); + return grub_error (GRUB_ERR_BAD_DEVICE, "cannot get C/H/S values"); } if (! total_sectors) @@ -189,45 +189,45 @@ pupa_biosdisk_open (const char *name, pupa_disk_t disk) disk->total_sectors = total_sectors; disk->data = data; - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } static void -pupa_biosdisk_close (pupa_disk_t disk) +grub_biosdisk_close (grub_disk_t disk) { - pupa_free (disk->data); + grub_free (disk->data); } /* For readability. */ -#define PUPA_BIOSDISK_READ 0 -#define PUPA_BIOSDISK_WRITE 1 +#define GRUB_BIOSDISK_READ 0 +#define GRUB_BIOSDISK_WRITE 1 -static pupa_err_t -pupa_biosdisk_rw (int cmd, pupa_disk_t disk, +static grub_err_t +grub_biosdisk_rw (int cmd, grub_disk_t disk, unsigned long sector, unsigned long size, unsigned segment) { - struct pupa_biosdisk_data *data = disk->data; + struct grub_biosdisk_data *data = disk->data; - if (data->flags & PUPA_BIOSDISK_FLAG_LBA) + if (data->flags & GRUB_BIOSDISK_FLAG_LBA) { - struct pupa_biosdisk_dap *dap; + struct grub_biosdisk_dap *dap; - dap = (struct pupa_biosdisk_dap *) (PUPA_MEMORY_MACHINE_SCRATCH_ADDR + dap = (struct grub_biosdisk_dap *) (GRUB_MEMORY_MACHINE_SCRATCH_ADDR + (data->sectors - << PUPA_DISK_SECTOR_BITS)); + << GRUB_DISK_SECTOR_BITS)); dap->length = sizeof (*dap); dap->reserved = 0; dap->blocks = size; dap->buffer = segment << 16; /* The format SEGMENT:ADDRESS. */ dap->block = sector; - if (pupa_biosdisk_rw_int13_extensions (cmd + 0x42, data->drive, dap)) + if (grub_biosdisk_rw_int13_extensions (cmd + 0x42, data->drive, dap)) { /* Fall back to the CHS mode. */ - data->flags &= ~PUPA_BIOSDISK_FLAG_LBA; + data->flags &= ~GRUB_BIOSDISK_FLAG_LBA; disk->total_sectors = data->cylinders * data->heads * data->sectors; - return pupa_biosdisk_rw (cmd, disk, sector, size, segment); + return grub_biosdisk_rw (cmd, disk, sector, size, segment); } } else @@ -241,29 +241,29 @@ pupa_biosdisk_rw (int cmd, pupa_disk_t disk, coff = head / data->heads; if (coff >= data->cylinders) - return pupa_error (PUPA_ERR_OUT_OF_RANGE, "out of disk"); + return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of disk"); - if (pupa_biosdisk_rw_standard (cmd + 0x02, data->drive, + if (grub_biosdisk_rw_standard (cmd + 0x02, data->drive, coff, hoff, soff, size, segment)) { switch (cmd) { - case PUPA_BIOSDISK_READ: - return pupa_error (PUPA_ERR_READ_ERROR, "biosdisk read error"); - case PUPA_BIOSDISK_WRITE: - return pupa_error (PUPA_ERR_WRITE_ERROR, "biosdisk write error"); + case GRUB_BIOSDISK_READ: + return grub_error (GRUB_ERR_READ_ERROR, "biosdisk read error"); + case GRUB_BIOSDISK_WRITE: + return grub_error (GRUB_ERR_WRITE_ERROR, "biosdisk write error"); } } } - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } -static pupa_err_t -pupa_biosdisk_read (pupa_disk_t disk, unsigned long sector, +static grub_err_t +grub_biosdisk_read (grub_disk_t disk, unsigned long sector, unsigned long size, char *buf) { - struct pupa_biosdisk_data *data = disk->data; + struct grub_biosdisk_data *data = disk->data; while (size) { @@ -273,25 +273,25 @@ pupa_biosdisk_read (pupa_disk_t disk, unsigned long sector, if (len > size) len = size; - if (pupa_biosdisk_rw (PUPA_BIOSDISK_READ, disk, sector, len, - PUPA_MEMORY_MACHINE_SCRATCH_SEG)) - return pupa_errno; + if (grub_biosdisk_rw (GRUB_BIOSDISK_READ, disk, sector, len, + GRUB_MEMORY_MACHINE_SCRATCH_SEG)) + return grub_errno; - pupa_memcpy (buf, (void *) PUPA_MEMORY_MACHINE_SCRATCH_ADDR, - len << PUPA_DISK_SECTOR_BITS); - buf += len << PUPA_DISK_SECTOR_BITS; + grub_memcpy (buf, (void *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR, + len << GRUB_DISK_SECTOR_BITS); + buf += len << GRUB_DISK_SECTOR_BITS; sector += len; size -= len; } - return pupa_errno; + return grub_errno; } -static pupa_err_t -pupa_biosdisk_write (pupa_disk_t disk, unsigned long sector, +static grub_err_t +grub_biosdisk_write (grub_disk_t disk, unsigned long sector, unsigned long size, const char *buf) { - struct pupa_biosdisk_data *data = disk->data; + struct grub_biosdisk_data *data = disk->data; while (size) { @@ -301,34 +301,34 @@ pupa_biosdisk_write (pupa_disk_t disk, unsigned long sector, if (len > size) len = size; - pupa_memcpy ((void *) PUPA_MEMORY_MACHINE_SCRATCH_ADDR, buf, - len << PUPA_DISK_SECTOR_BITS); + grub_memcpy ((void *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR, buf, + len << GRUB_DISK_SECTOR_BITS); - if (pupa_biosdisk_rw (PUPA_BIOSDISK_WRITE, disk, sector, len, - PUPA_MEMORY_MACHINE_SCRATCH_SEG)) - return pupa_errno; + if (grub_biosdisk_rw (GRUB_BIOSDISK_WRITE, disk, sector, len, + GRUB_MEMORY_MACHINE_SCRATCH_SEG)) + return grub_errno; - buf += len << PUPA_DISK_SECTOR_BITS; + buf += len << GRUB_DISK_SECTOR_BITS; sector += len; size -= len; } - return pupa_errno; + return grub_errno; } -static struct pupa_disk_dev pupa_biosdisk_dev = +static struct grub_disk_dev grub_biosdisk_dev = { .name = "biosdisk", - .iterate = pupa_biosdisk_iterate, - .open = pupa_biosdisk_open, - .close = pupa_biosdisk_close, - .read = pupa_biosdisk_read, - .write = pupa_biosdisk_write, + .iterate = grub_biosdisk_iterate, + .open = grub_biosdisk_open, + .close = grub_biosdisk_close, + .read = grub_biosdisk_read, + .write = grub_biosdisk_write, .next = 0 }; void -pupa_biosdisk_init (void) +grub_biosdisk_init (void) { - pupa_disk_dev_register (&pupa_biosdisk_dev); + grub_disk_dev_register (&grub_biosdisk_dev); } diff --git a/disk/i386/pc/partition.c b/disk/i386/pc/partition.c index 171180bda..f6eee6373 100644 --- a/disk/i386/pc/partition.c +++ b/disk/i386/pc/partition.c @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,23 +13,23 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include +#include +#include +#include +#include /* Parse the partition representation in STR and return a partition. */ -static pupa_partition_t -pupa_partition_parse (const char *str) +static grub_partition_t +grub_partition_parse (const char *str) { - pupa_partition_t p; + grub_partition_t p; char *s = (char *) str; - p = (pupa_partition_t) pupa_malloc (sizeof (*p)); + p = (grub_partition_t) grub_malloc (sizeof (*p)); if (! p) return 0; @@ -37,13 +37,13 @@ pupa_partition_parse (const char *str) p->bsd_part = p->dos_type = p->bsd_type = p->index = -1; /* Get the DOS partition number. */ - p->dos_part = pupa_strtoul (s, &s, 0); + p->dos_part = grub_strtoul (s, &s, 0); - if (pupa_errno) + if (grub_errno) { /* Not found. Maybe only a BSD label is specified. */ p->dos_part = -1; - pupa_errno = PUPA_ERR_NONE; + grub_errno = GRUB_ERR_NONE; } else if (*s == ',') s++; @@ -66,19 +66,19 @@ pupa_partition_parse (const char *str) return p; fail: - pupa_free (p); - pupa_error (PUPA_ERR_BAD_FILENAME, "invalid partition"); + grub_free (p); + grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition"); return 0; } -pupa_err_t -pupa_partition_iterate (pupa_disk_t disk, - int (*hook) (const pupa_partition_t partition)) +grub_err_t +grub_partition_iterate (grub_disk_t disk, + int (*hook) (const grub_partition_t partition)) { - struct pupa_partition p; - struct pupa_partition_mbr mbr; - struct pupa_partition_disk_label label; - struct pupa_disk raw; + struct grub_partition p; + struct grub_partition_mbr mbr; + struct grub_partition_disk_label label; + struct grub_disk raw; /* Enforce raw disk access. */ raw = *disk; @@ -91,30 +91,30 @@ pupa_partition_iterate (pupa_disk_t disk, while (1) { int i; - struct pupa_partition_entry *e; + struct grub_partition_entry *e; /* Read the MBR. */ - if (pupa_disk_read (&raw, p.offset, 0, sizeof (mbr), (char *) &mbr)) + if (grub_disk_read (&raw, p.offset, 0, sizeof (mbr), (char *) &mbr)) goto finish; /* Check if it is valid. */ - if (mbr.signature != pupa_cpu_to_le16 (PUPA_PARTITION_SIGNATURE)) - return pupa_error (PUPA_ERR_BAD_PART_TABLE, "no signature"); + if (mbr.signature != grub_cpu_to_le16 (GRUB_PARTITION_SIGNATURE)) + return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature"); /* Analyze DOS partitions. */ for (p.index = 0; p.index < 4; p.index++) { e = mbr.entries + p.index; - p.start = p.offset + pupa_le_to_cpu32 (e->start); - p.len = pupa_le_to_cpu32 (e->length); + p.start = p.offset + grub_le_to_cpu32 (e->start); + p.len = grub_le_to_cpu32 (e->length); p.bsd_part = -1; p.dos_type = e->type; p.bsd_type = -1; /* If this partition is a normal one, call the hook. */ - if (! pupa_partition_is_empty (e->type) - && ! pupa_partition_is_extended (e->type)) + if (! grub_partition_is_empty (e->type) + && ! grub_partition_is_extended (e->type)) { p.dos_part++; @@ -122,17 +122,17 @@ pupa_partition_iterate (pupa_disk_t disk, goto finish; /* Check if this is a BSD partition. */ - if (pupa_partition_is_bsd (e->type)) + if (grub_partition_is_bsd (e->type)) { /* Check if the BSD label is within the DOS partition. */ - if (p.len <= PUPA_PARTITION_BSD_LABEL_SECTOR) - return pupa_error (PUPA_ERR_BAD_PART_TABLE, + if (p.len <= GRUB_PARTITION_BSD_LABEL_SECTOR) + return grub_error (GRUB_ERR_BAD_PART_TABLE, "no space for disk label"); /* Read the BSD label. */ - if (pupa_disk_read (&raw, + if (grub_disk_read (&raw, (p.start - + PUPA_PARTITION_BSD_LABEL_SECTOR), + + GRUB_PARTITION_BSD_LABEL_SECTOR), 0, sizeof (label), (char *) &label)) @@ -140,22 +140,22 @@ pupa_partition_iterate (pupa_disk_t disk, /* Check if it is valid. */ if (label.magic - != pupa_cpu_to_le32 (PUPA_PARTITION_BSD_LABEL_MAGIC)) - return pupa_error (PUPA_ERR_BAD_PART_TABLE, + != grub_cpu_to_le32 (GRUB_PARTITION_BSD_LABEL_MAGIC)) + return grub_error (GRUB_ERR_BAD_PART_TABLE, "invalid disk label magic"); for (p.bsd_part = 0; - p.bsd_part < pupa_cpu_to_le16 (label.num_partitions); + p.bsd_part < grub_cpu_to_le16 (label.num_partitions); p.bsd_part++) { - struct pupa_partition_bsd_entry *be + struct grub_partition_bsd_entry *be = label.entries + p.bsd_part; - p.start = pupa_le_to_cpu32 (be->offset); - p.len = pupa_le_to_cpu32 (be->size); + p.start = grub_le_to_cpu32 (be->offset); + p.len = grub_le_to_cpu32 (be->size); p.bsd_type = be->fs_type; - if (be->fs_type != PUPA_PARTITION_BSD_TYPE_UNUSED) + if (be->fs_type != GRUB_PARTITION_BSD_TYPE_UNUSED) if (hook (&p)) goto finish; } @@ -172,9 +172,9 @@ pupa_partition_iterate (pupa_disk_t disk, { e = mbr.entries + i; - if (pupa_partition_is_extended (e->type)) + if (grub_partition_is_extended (e->type)) { - p.offset = p.ext_offset + pupa_le_to_cpu32 (e->start); + p.offset = p.ext_offset + grub_le_to_cpu32 (e->start); if (! p.ext_offset) p.ext_offset = p.offset; @@ -188,61 +188,61 @@ pupa_partition_iterate (pupa_disk_t disk, } finish: - return pupa_errno; + return grub_errno; } -pupa_partition_t -pupa_partition_probe (pupa_disk_t disk, const char *str) +grub_partition_t +grub_partition_probe (grub_disk_t disk, const char *str) { - pupa_partition_t p; - auto int find_func (const pupa_partition_t partition); + grub_partition_t p; + auto int find_func (const grub_partition_t partition); - int find_func (const pupa_partition_t partition) + int find_func (const grub_partition_t partition) { if ((p->dos_part == partition->dos_part || p->dos_part == -1) && p->bsd_part == partition->bsd_part) { - pupa_memcpy (p, partition, sizeof (*p)); + grub_memcpy (p, partition, sizeof (*p)); return 1; } return 0; } - p = pupa_partition_parse (str); + p = grub_partition_parse (str); if (! p) return 0; - if (pupa_partition_iterate (disk, find_func)) + if (grub_partition_iterate (disk, find_func)) goto fail; if (p->index < 0) { - pupa_error (PUPA_ERR_BAD_DEVICE, "no such partition"); + grub_error (GRUB_ERR_BAD_DEVICE, "no such partition"); goto fail; } return p; fail: - pupa_free (p); + grub_free (p); return 0; } char * -pupa_partition_get_name (const pupa_partition_t p) +grub_partition_get_name (const grub_partition_t p) { char *name; - name = pupa_malloc (13); + name = grub_malloc (13); if (! name) return 0; if (p->bsd_part < 0) - pupa_sprintf (name, "%d", p->dos_part); + grub_sprintf (name, "%d", p->dos_part); else - pupa_sprintf (name, "%d,%c", p->dos_part, p->bsd_part + 'a'); + grub_sprintf (name, "%d,%c", p->dos_part, p->bsd_part + 'a'); return name; } diff --git a/disk/powerpc/ieee1275/ofdisk.c b/disk/powerpc/ieee1275/ofdisk.c index a43bd0d51..7c21d6699 100644 --- a/disk/powerpc/ieee1275/ofdisk.c +++ b/disk/powerpc/ieee1275/ofdisk.c @@ -1,6 +1,6 @@ /* ofdisk.c - Open Firmware disk access. */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,70 +18,70 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include +#include +#include +#include +#include static int -pupa_ofdisk_iterate (int (*hook) (const char *name)) +grub_ofdisk_iterate (int (*hook) (const char *name)) { - int dev_iterate (struct pupa_ieee1275_devalias *alias) + int dev_iterate (struct grub_ieee1275_devalias *alias) { - if (! pupa_strcmp (alias->type, "block")) + if (! grub_strcmp (alias->type, "block")) hook (alias->name); return 0; } - pupa_devalias_iterate (dev_iterate); + grub_devalias_iterate (dev_iterate); return 0; } -static pupa_err_t -pupa_ofdisk_open (const char *name, pupa_disk_t disk) +static grub_err_t +grub_ofdisk_open (const char *name, grub_disk_t disk) { - pupa_ieee1275_phandle_t devalias; - pupa_ieee1275_phandle_t dev; - pupa_ieee1275_ihandle_t dev_ihandle = 0; + grub_ieee1275_phandle_t devalias; + grub_ieee1275_phandle_t dev; + grub_ieee1275_ihandle_t dev_ihandle = 0; char *devpath = 0; /* XXX: This should be large enough for any possible case. */ char prop[64]; - pupa_size_t pathlen; + grub_size_t pathlen; int actual; - if (pupa_ieee1275_finddevice ("/aliases", &devalias)) - return pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "Can't read the aliases"); + if (grub_ieee1275_finddevice ("/aliases", &devalias)) + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't read the aliases"); - pupa_ieee1275_get_property_length (devalias, name, &pathlen); - devpath = pupa_malloc (pathlen); + grub_ieee1275_get_property_length (devalias, name, &pathlen); + devpath = grub_malloc (pathlen); if (! devpath) - return pupa_errno; + return grub_errno; - if (pupa_ieee1275_get_property (devalias, name, devpath, pathlen, &actual)) - return pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "No such device alias"); + if (grub_ieee1275_get_property (devalias, name, devpath, pathlen, &actual)) + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "No such device alias"); /* To access the complete disk add `:0'. */ - pupa_strcat (devpath, ":0"); - pupa_ieee1275_open (devpath, &dev_ihandle); + grub_strcat (devpath, ":0"); + grub_ieee1275_open (devpath, &dev_ihandle); if (! dev_ihandle) - return pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "Can't open device"); + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't open device"); - if (pupa_ieee1275_finddevice (devpath, &dev)) + if (grub_ieee1275_finddevice (devpath, &dev)) { - pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "Can't read device properties"); + grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Can't read device properties"); goto fail; } - if (pupa_ieee1275_get_property (dev, "device_type", prop, sizeof (prop), + if (grub_ieee1275_get_property (dev, "device_type", prop, sizeof (prop), &actual)) { - pupa_error (PUPA_ERR_BAD_DEVICE, "Can't read the device type"); + grub_error (GRUB_ERR_BAD_DEVICE, "Can't read the device type"); goto fail; } - if (pupa_strcmp (prop, "block")) + if (grub_strcmp (prop, "block")) { - pupa_error (PUPA_ERR_BAD_DEVICE, "Not a block device"); + grub_error (GRUB_ERR_BAD_DEVICE, "Not a block device"); goto fail; } @@ -99,20 +99,20 @@ pupa_ofdisk_open (const char *name, pupa_disk_t disk) disk->data = (void *) dev_ihandle; fail: - if (pupa_errno) - pupa_ieee1275_close (dev_ihandle); - pupa_free (devpath); - return pupa_errno; + if (grub_errno) + grub_ieee1275_close (dev_ihandle); + grub_free (devpath); + return grub_errno; } static void -pupa_ofdisk_close (pupa_disk_t disk) +grub_ofdisk_close (grub_disk_t disk) { - pupa_ieee1275_close ((pupa_ieee1275_ihandle_t) disk->data); + grub_ieee1275_close ((grub_ieee1275_ihandle_t) disk->data); } -static pupa_err_t -pupa_ofdisk_read (pupa_disk_t disk, unsigned long sector, +static grub_err_t +grub_ofdisk_read (grub_disk_t disk, unsigned long sector, unsigned long size, char *buf) { int status; @@ -121,41 +121,41 @@ pupa_ofdisk_read (pupa_disk_t disk, unsigned long sector, pos = (unsigned long long) sector * 512UL; - pupa_ieee1275_seek ((pupa_ieee1275_ihandle_t) disk->data, (int) (pos >> 32), + grub_ieee1275_seek ((grub_ieee1275_ihandle_t) disk->data, (int) (pos >> 32), (int) pos & 0xFFFFFFFFUL, &status); if (status != 0) - return pupa_error (PUPA_ERR_READ_ERROR, + return grub_error (GRUB_ERR_READ_ERROR, "Seek error, can't seek block %d", sector); - pupa_ieee1275_read ((pupa_ieee1275_ihandle_t) disk->data, buf, + grub_ieee1275_read ((grub_ieee1275_ihandle_t) disk->data, buf, size * 512UL, &actual); if (actual != actual) - return pupa_error (PUPA_ERR_READ_ERROR, "Read error on block: %d", sector); + return grub_error (GRUB_ERR_READ_ERROR, "Read error on block: %d", sector); return 0; } -static pupa_err_t -pupa_ofdisk_write (pupa_disk_t disk __attribute ((unused)), +static grub_err_t +grub_ofdisk_write (grub_disk_t disk __attribute ((unused)), unsigned long sector __attribute ((unused)), unsigned long size __attribute ((unused)), const char *buf __attribute ((unused))) { - return PUPA_ERR_NOT_IMPLEMENTED_YET; + return GRUB_ERR_NOT_IMPLEMENTED_YET; } -static struct pupa_disk_dev pupa_ofdisk_dev = +static struct grub_disk_dev grub_ofdisk_dev = { .name = "ofdisk", - .iterate = pupa_ofdisk_iterate, - .open = pupa_ofdisk_open, - .close = pupa_ofdisk_close, - .read = pupa_ofdisk_read, - .write = pupa_ofdisk_write, + .iterate = grub_ofdisk_iterate, + .open = grub_ofdisk_open, + .close = grub_ofdisk_close, + .read = grub_ofdisk_read, + .write = grub_ofdisk_write, .next = 0 }; void -pupa_ofdisk_init (void) +grub_ofdisk_init (void) { - pupa_disk_dev_register (&pupa_ofdisk_dev); + grub_disk_dev_register (&grub_ofdisk_dev); } diff --git a/disk/powerpc/ieee1275/partition.c b/disk/powerpc/ieee1275/partition.c index 4d4b4b412..0a48a8412 100644 --- a/disk/powerpc/ieee1275/partition.c +++ b/disk/powerpc/ieee1275/partition.c @@ -1,6 +1,6 @@ /* partiton.c - Read macintosh partition tables. */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,20 +18,20 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include +#include +#include +#include +#include -pupa_err_t -pupa_partition_iterate (pupa_disk_t disk, - int (*hook) (const pupa_partition_t partition)) +grub_err_t +grub_partition_iterate (grub_disk_t disk, + int (*hook) (const grub_partition_t partition)) { - struct pupa_partition part; - struct pupa_apple_part apart; - struct pupa_disk raw; + struct grub_partition part; + struct grub_apple_part apart; + struct grub_disk raw; int partno = 0; - int pos = PUPA_DISK_SECTOR_SIZE * 2; + int pos = GRUB_DISK_SECTOR_SIZE * 2; /* Enforce raw disk access. */ raw = *disk; @@ -39,12 +39,12 @@ pupa_partition_iterate (pupa_disk_t disk, for (;;) { - if (pupa_disk_read (&raw, pos / PUPA_DISK_SECTOR_SIZE, - pos % PUPA_DISK_SECTOR_SIZE, - sizeof (struct pupa_apple_part), (char *) &apart)) - return pupa_errno; + if (grub_disk_read (&raw, pos / GRUB_DISK_SECTOR_SIZE, + pos % GRUB_DISK_SECTOR_SIZE, + sizeof (struct grub_apple_part), (char *) &apart)) + return grub_errno; - if (apart.magic != PUPA_APPLE_PART_MAGIC) + if (apart.magic != GRUB_APPLE_PART_MAGIC) break; part.start = apart.first_phys_block; @@ -53,34 +53,34 @@ pupa_partition_iterate (pupa_disk_t disk, part.index = partno; if (hook (&part)) - return pupa_errno; + return grub_errno; - if (apart.first_phys_block == PUPA_DISK_SECTOR_SIZE * 2) + if (apart.first_phys_block == GRUB_DISK_SECTOR_SIZE * 2) return 0; - pos += sizeof (struct pupa_apple_part); + pos += sizeof (struct grub_apple_part); partno++; } return 0; } -pupa_partition_t -pupa_partition_probe (pupa_disk_t disk, const char *str) +grub_partition_t +grub_partition_probe (grub_disk_t disk, const char *str) { - pupa_partition_t p; + grub_partition_t p; int partnum = 0; char *s = (char *) str; - int find_func (const pupa_partition_t partition) + int find_func (const grub_partition_t partition) { if (partnum == partition->index) { - p = (pupa_partition_t) pupa_malloc (sizeof (*p)); + p = (grub_partition_t) grub_malloc (sizeof (*p)); if (! p) return 1; - pupa_memcpy (p, partition, sizeof (*p)); + grub_memcpy (p, partition, sizeof (*p)); return 1; } @@ -88,33 +88,33 @@ pupa_partition_probe (pupa_disk_t disk, const char *str) } /* Get the partition number. */ - partnum = pupa_strtoul (s, &s, 0); - if (pupa_errno) + partnum = grub_strtoul (s, &s, 0); + if (grub_errno) { - pupa_error (PUPA_ERR_BAD_FILENAME, "invalid partition"); + grub_error (GRUB_ERR_BAD_FILENAME, "invalid partition"); return 0; } - if (pupa_partition_iterate (disk, find_func)) + if (grub_partition_iterate (disk, find_func)) goto fail; return p; fail: - pupa_free (p); + grub_free (p); return 0; } char * -pupa_partition_get_name (const pupa_partition_t p) +grub_partition_get_name (const grub_partition_t p) { char *name; - name = pupa_malloc (13); + name = grub_malloc (13); if (! name) return 0; - pupa_sprintf (name, "%d", p->index); + grub_sprintf (name, "%d", p->index); return name; } diff --git a/font/manager.c b/font/manager.c index 6aac232b5..9f9c6ce4d 100644 --- a/font/manager.c +++ b/font/manager.c @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,25 +17,25 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include struct entry { - pupa_uint32_t code; - pupa_uint32_t offset; + grub_uint32_t code; + grub_uint32_t offset; }; struct font { struct font *next; - pupa_file_t file; - pupa_uint32_t num; + grub_file_t file; + grub_uint32_t num; struct entry table[0]; }; @@ -44,29 +44,29 @@ static struct font *font_list; static int add_font (const char *filename) { - pupa_file_t file = 0; + grub_file_t file = 0; char magic[4]; - pupa_uint32_t num, i; + grub_uint32_t num, i; struct font *font = 0; - file = pupa_file_open (filename); + file = grub_file_open (filename); if (! file) goto fail; - if (pupa_file_read (file, magic, 4) != 4) + if (grub_file_read (file, magic, 4) != 4) goto fail; - if (pupa_memcmp (magic, PUPA_FONT_MAGIC, 4) != 0) + if (grub_memcmp (magic, GRUB_FONT_MAGIC, 4) != 0) { - pupa_error (PUPA_ERR_BAD_FONT, "invalid font magic"); + grub_error (GRUB_ERR_BAD_FONT, "invalid font magic"); goto fail; } - if (pupa_file_read (file, (char *) &num, 4) != 4) + if (grub_file_read (file, (char *) &num, 4) != 4) goto fail; - num = pupa_le_to_cpu32 (num); - font = (struct font *) pupa_malloc (sizeof (struct font) + num = grub_le_to_cpu32 (num); + font = (struct font *) grub_malloc (sizeof (struct font) + sizeof (struct entry) * num); if (! font) goto fail; @@ -76,16 +76,16 @@ add_font (const char *filename) for (i = 0; i < num; i++) { - pupa_uint32_t code, offset; + grub_uint32_t code, offset; - if (pupa_file_read (file, (char *) &code, 4) != 4) + if (grub_file_read (file, (char *) &code, 4) != 4) goto fail; - if (pupa_file_read (file, (char *) &offset, 4) != 4) + if (grub_file_read (file, (char *) &offset, 4) != 4) goto fail; - font->table[i].code = pupa_le_to_cpu32 (code); - font->table[i].offset = pupa_le_to_cpu32 (offset); + font->table[i].code = grub_le_to_cpu32 (code); + font->table[i].offset = grub_le_to_cpu32 (offset); } font->next = font_list; @@ -95,10 +95,10 @@ add_font (const char *filename) fail: if (font) - pupa_free (font); + grub_free (font); if (file) - pupa_file_close (file); + grub_file_close (file); return 0; } @@ -113,8 +113,8 @@ remove_font (struct font *font) { *p = q->next; - pupa_file_close (font->file); - pupa_free (font); + grub_file_close (font->file); + grub_free (font); break; } @@ -122,11 +122,11 @@ remove_font (struct font *font) /* Return the offset of the glyph corresponding to the codepoint CODE in the font FONT. If no found, return zero. */ -static pupa_uint32_t -find_glyph (const struct font *font, pupa_uint32_t code) +static grub_uint32_t +find_glyph (const struct font *font, grub_uint32_t code) { - pupa_uint32_t start = 0; - pupa_uint32_t end = font->num - 1; + grub_uint32_t start = 0; + grub_uint32_t end = font->num - 1; struct entry *table = font->table; /* This shouldn't happen. */ @@ -136,7 +136,7 @@ find_glyph (const struct font *font, pupa_uint32_t code) /* Do a binary search. */ while (start <= end) { - pupa_uint32_t i = (start + end) / 2; + grub_uint32_t i = (start + end) / 2; if (table[i].code < code) start = i + 1; @@ -167,7 +167,7 @@ fill_with_default_glyph (unsigned char bitmap[32], unsigned *width) /* Get a glyph corresponding to the codepoint CODE. Always fill BITMAP and WIDTH with something, even if no glyph is found. */ int -pupa_font_get_glyph (pupa_uint32_t code, +grub_font_get_glyph (grub_uint32_t code, unsigned char bitmap[32], unsigned *width) { struct font *font; @@ -177,31 +177,31 @@ pupa_font_get_glyph (pupa_uint32_t code, restart: for (font = font_list; font; font = font->next) { - pupa_uint32_t offset; + grub_uint32_t offset; offset = find_glyph (font, code); if (offset) { - pupa_uint32_t w; + grub_uint32_t w; - pupa_file_seek (font->file, offset); - if (pupa_file_read (font->file, (char *) &w, 4) != 4) + grub_file_seek (font->file, offset); + if (grub_file_read (font->file, (char *) &w, 4) != 4) { remove_font (font); goto restart; } - w = pupa_le_to_cpu32 (w); + w = grub_le_to_cpu32 (w); if (w != 1 && w != 2) { - /* pupa_error (PUPA_ERR_BAD_FONT, "invalid width"); */ + /* grub_error (GRUB_ERR_BAD_FONT, "invalid width"); */ remove_font (font); goto restart; } if (bitmap - && (pupa_file_read (font->file, bitmap, w * 16) - != (pupa_ssize_t) w * 16)) + && (grub_file_read (font->file, bitmap, w * 16) + != (grub_ssize_t) w * 16)) { remove_font (font); goto restart; @@ -217,13 +217,13 @@ pupa_font_get_glyph (pupa_uint32_t code, return 0; } -static pupa_err_t -font_command (struct pupa_arg_list *state __attribute__ ((unused)), +static grub_err_t +font_command (struct grub_arg_list *state __attribute__ ((unused)), int argc __attribute__ ((unused)), char **args __attribute__ ((unused))) { if (argc == 0) - return pupa_error (PUPA_ERR_BAD_ARGUMENT, "no font specified"); + return grub_error (GRUB_ERR_BAD_ARGUMENT, "no font specified"); while (argc--) if (! add_font (*args++)) @@ -232,14 +232,14 @@ font_command (struct pupa_arg_list *state __attribute__ ((unused)), return 0; } -PUPA_MOD_INIT +GRUB_MOD_INIT { (void) mod; /* Stop warning. */ - pupa_register_command ("font", font_command, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("font", font_command, GRUB_COMMAND_FLAG_BOTH, "font FILE...", "Specify a font file to display.", 0); } -PUPA_MOD_FINI +GRUB_MOD_FINI { - pupa_unregister_command ("font"); + grub_unregister_command ("font"); } diff --git a/fs/ext2.c b/fs/ext2.c index 79794a03a..7b1ffc7d4 100644 --- a/fs/ext2.c +++ b/fs/ext2.c @@ -1,6 +1,6 @@ /* ext2.c - Second Extended filesystem */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003, 2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -31,139 +31,139 @@ #define FILETYPE_DIRECTORY 2 #define FILETYPE_SYMLINK 7 -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include /* Log2 size of ext2 block in 512 blocks. */ #define LOG2_EXT2_BLOCK_SIZE(data) \ - (pupa_le_to_cpu32 (data->sblock.log2_block_size) + 1) + (grub_le_to_cpu32 (data->sblock.log2_block_size) + 1) /* Log2 size of ext2 block in bytes. */ #define LOG2_BLOCK_SIZE(data) \ - (pupa_le_to_cpu32 (data->sblock.log2_block_size) + 10) + (grub_le_to_cpu32 (data->sblock.log2_block_size) + 10) /* The size of an ext2 block in bytes. */ #define EXT2_BLOCK_SIZE(data) (1 << LOG2_BLOCK_SIZE(data)) /* The ext2 superblock. */ -struct pupa_ext_sblock +struct grub_ext_sblock { - pupa_uint32_t total_inodes; - pupa_uint32_t total_blocks; - pupa_uint32_t reserved_blocks; - pupa_uint32_t free_blocks; - pupa_uint32_t free_inodes; - pupa_uint32_t first_data_block; - pupa_uint32_t log2_block_size; - pupa_uint32_t log2_fragment_size; - pupa_uint32_t blocks_per_group; - pupa_uint32_t fragments_per_group; - pupa_uint32_t inodes_per_group; - pupa_uint32_t mtime; - pupa_uint32_t utime; - pupa_uint16_t mnt_count; - pupa_uint16_t max_mnt_count; - pupa_uint16_t magic; - pupa_uint16_t fs_state; - pupa_uint16_t error_handling; - pupa_uint16_t minor_revision_level; - pupa_uint32_t lastcheck; - pupa_uint32_t checkinterval; - pupa_uint32_t creator_os; - pupa_uint32_t revision_level; - pupa_uint16_t uid_reserved; - pupa_uint16_t gid_reserved; - pupa_uint32_t first_inode; - pupa_uint16_t inode_size; - pupa_uint16_t block_group_number; - pupa_uint32_t feature_compatibility; - pupa_uint32_t feature_incompat; - pupa_uint32_t feature_ro_compat; - pupa_uint32_t unique_id[4]; + grub_uint32_t total_inodes; + grub_uint32_t total_blocks; + grub_uint32_t reserved_blocks; + grub_uint32_t free_blocks; + grub_uint32_t free_inodes; + grub_uint32_t first_data_block; + grub_uint32_t log2_block_size; + grub_uint32_t log2_fragment_size; + grub_uint32_t blocks_per_group; + grub_uint32_t fragments_per_group; + grub_uint32_t inodes_per_group; + grub_uint32_t mtime; + grub_uint32_t utime; + grub_uint16_t mnt_count; + grub_uint16_t max_mnt_count; + grub_uint16_t magic; + grub_uint16_t fs_state; + grub_uint16_t error_handling; + grub_uint16_t minor_revision_level; + grub_uint32_t lastcheck; + grub_uint32_t checkinterval; + grub_uint32_t creator_os; + grub_uint32_t revision_level; + grub_uint16_t uid_reserved; + grub_uint16_t gid_reserved; + grub_uint32_t first_inode; + grub_uint16_t inode_size; + grub_uint16_t block_group_number; + grub_uint32_t feature_compatibility; + grub_uint32_t feature_incompat; + grub_uint32_t feature_ro_compat; + grub_uint32_t unique_id[4]; char volume_name[16]; char last_mounted_on[64]; - pupa_uint32_t compression_info; + grub_uint32_t compression_info; }; /* The ext2 blockgroup. */ struct ext2_block_group { - pupa_uint32_t block_id; - pupa_uint32_t inode_id; - pupa_uint32_t inode_table_id; - pupa_uint16_t free_blocks; - pupa_uint16_t free_inodes; - pupa_uint16_t pad; - pupa_uint32_t reserved[3]; + grub_uint32_t block_id; + grub_uint32_t inode_id; + grub_uint32_t inode_table_id; + grub_uint16_t free_blocks; + grub_uint16_t free_inodes; + grub_uint16_t pad; + grub_uint32_t reserved[3]; }; /* The ext2 inode. */ -struct pupa_ext2_inode +struct grub_ext2_inode { - pupa_uint16_t mode; - pupa_uint16_t uid; - pupa_uint32_t size; - pupa_uint32_t atime; - pupa_uint32_t ctime; - pupa_uint32_t mtime; - pupa_uint32_t dtime; - pupa_uint16_t gid; - pupa_uint16_t nlinks; - pupa_uint32_t blockcnt; /* Blocks of 512 bytes!! */ - pupa_uint32_t flags; - pupa_uint32_t osd1; + grub_uint16_t mode; + grub_uint16_t uid; + grub_uint32_t size; + grub_uint32_t atime; + grub_uint32_t ctime; + grub_uint32_t mtime; + grub_uint32_t dtime; + grub_uint16_t gid; + grub_uint16_t nlinks; + grub_uint32_t blockcnt; /* Blocks of 512 bytes!! */ + grub_uint32_t flags; + grub_uint32_t osd1; union { struct datablocks { - pupa_uint32_t dir_blocks[INDIRECT_BLOCKS]; - pupa_uint32_t indir_block; - pupa_uint32_t double_indir_block; - pupa_uint32_t tripple_indir_block; + grub_uint32_t dir_blocks[INDIRECT_BLOCKS]; + grub_uint32_t indir_block; + grub_uint32_t double_indir_block; + grub_uint32_t tripple_indir_block; } blocks; char symlink[60]; }; - pupa_uint32_t version; - pupa_uint32_t acl; - pupa_uint32_t dir_acl; - pupa_uint32_t fragment_addr; - pupa_uint32_t osd2[3]; + grub_uint32_t version; + grub_uint32_t acl; + grub_uint32_t dir_acl; + grub_uint32_t fragment_addr; + grub_uint32_t osd2[3]; }; /* The header of an ext2 directory entry. */ struct ext2_dirent { - pupa_uint32_t inode; - pupa_uint16_t direntlen; - pupa_uint8_t namelen; - pupa_uint8_t filetype; + grub_uint32_t inode; + grub_uint16_t direntlen; + grub_uint8_t namelen; + grub_uint8_t filetype; }; /* Information about a "mounted" ext2 filesystem. */ -struct pupa_ext2_data +struct grub_ext2_data { - struct pupa_ext_sblock sblock; - pupa_disk_t disk; - struct pupa_ext2_inode inode; + struct grub_ext_sblock sblock; + grub_disk_t disk; + struct grub_ext2_inode inode; }; -#ifndef PUPA_UTIL -static pupa_dl_t my_mod; +#ifndef GRUB_UTIL +static grub_dl_t my_mod; #endif /* Read into BLKGRP the blockgroup descriptor of blockgroup GROUP of the mounted filesystem DATA. */ -inline static pupa_err_t -pupa_ext2_blockgroup (struct pupa_ext2_data *data, int group, +inline static grub_err_t +grub_ext2_blockgroup (struct grub_ext2_data *data, int group, struct ext2_block_group *blkgrp) { - return pupa_disk_read (data->disk, - ((pupa_le_to_cpu32 (data->sblock.first_data_block) + 1) + return grub_disk_read (data->disk, + ((grub_le_to_cpu32 (data->sblock.first_data_block) + 1) << LOG2_EXT2_BLOCK_SIZE (data)), group * sizeof (struct ext2_block_group), sizeof (struct ext2_block_group), (char *) blkgrp); @@ -172,28 +172,28 @@ pupa_ext2_blockgroup (struct pupa_ext2_data *data, int group, /* Return in BLOCK the on disk block number of block FILEBLOCK in the opened file descibed by DATA. If this block is not stored on disk in case of a sparse file return 0. */ -static pupa_err_t -pupa_ext2_get_file_block (struct pupa_ext2_data *data, +static grub_err_t +grub_ext2_get_file_block (struct grub_ext2_data *data, int fileblock, int *block) { int blknr; - struct pupa_ext2_inode *inode = &data->inode; + struct grub_ext2_inode *inode = &data->inode; /* Direct blocks. */ if (fileblock < INDIRECT_BLOCKS) - blknr = pupa_le_to_cpu32 (inode->blocks.dir_blocks[fileblock]); + blknr = grub_le_to_cpu32 (inode->blocks.dir_blocks[fileblock]); /* Indirect. */ else if (fileblock < INDIRECT_BLOCKS + EXT2_BLOCK_SIZE (data) / 4) { - pupa_uint32_t indir[EXT2_BLOCK_SIZE (data) / 4]; + grub_uint32_t indir[EXT2_BLOCK_SIZE (data) / 4]; - if (pupa_disk_read (data->disk, - pupa_le_to_cpu32 (inode->blocks.indir_block) + if (grub_disk_read (data->disk, + grub_le_to_cpu32 (inode->blocks.indir_block) << LOG2_EXT2_BLOCK_SIZE (data), 0, EXT2_BLOCK_SIZE (data), (char *) indir)) - return pupa_errno; + return grub_errno; - blknr = pupa_le_to_cpu32 (indir[fileblock - INDIRECT_BLOCKS]); + blknr = grub_le_to_cpu32 (indir[fileblock - INDIRECT_BLOCKS]); } /* Double indirect. */ else if (fileblock < INDIRECT_BLOCKS + EXT2_BLOCK_SIZE (data) / 4 @@ -202,29 +202,29 @@ pupa_ext2_get_file_block (struct pupa_ext2_data *data, unsigned int perblock = EXT2_BLOCK_SIZE (data) / 4; unsigned int rblock = fileblock - (INDIRECT_BLOCKS + EXT2_BLOCK_SIZE (data) / 4); - pupa_uint32_t indir[EXT2_BLOCK_SIZE (data) / 4]; + grub_uint32_t indir[EXT2_BLOCK_SIZE (data) / 4]; - if (pupa_disk_read (data->disk, - pupa_le_to_cpu32 (inode->blocks.double_indir_block) + if (grub_disk_read (data->disk, + grub_le_to_cpu32 (inode->blocks.double_indir_block) << LOG2_EXT2_BLOCK_SIZE (data), 0, EXT2_BLOCK_SIZE (data), (char *) indir)) - return pupa_errno; + return grub_errno; - if (pupa_disk_read (data->disk, - pupa_le_to_cpu32 (indir[rblock / perblock]) + if (grub_disk_read (data->disk, + grub_le_to_cpu32 (indir[rblock / perblock]) << LOG2_EXT2_BLOCK_SIZE (data), 0, EXT2_BLOCK_SIZE (data), (char *) indir)) - return pupa_errno; + return grub_errno; - blknr = pupa_le_to_cpu32 (indir[rblock % perblock]); + blknr = grub_le_to_cpu32 (indir[rblock % perblock]); } /* Tripple indirect. */ else { - pupa_error (PUPA_ERR_NOT_IMPLEMENTED_YET, + grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "ext2fs doesn't support tripple indirect blocks"); - return pupa_errno; + return grub_errno; } *block = blknr; @@ -234,8 +234,8 @@ pupa_ext2_get_file_block (struct pupa_ext2_data *data, /* Read LEN bytes from the file described by DATA starting with byte POS. Return the amount of read bytes in READ. */ -static pupa_ssize_t -pupa_ext2_read_file (struct pupa_ext2_data *data, +static grub_ssize_t +grub_ext2_read_file (struct grub_ext2_data *data, void (*read_hook) (unsigned long sector, unsigned offset, unsigned length), int pos, unsigned int len, char *buf) @@ -244,8 +244,8 @@ pupa_ext2_read_file (struct pupa_ext2_data *data, int blockcnt; /* Adjust len so it we can't read past the end of the file. */ - if (len > pupa_le_to_cpu32 (data->inode.size)) - len = pupa_le_to_cpu32 (data->inode.size); + if (len > grub_le_to_cpu32 (data->inode.size)) + len = grub_le_to_cpu32 (data->inode.size); blockcnt = ((len + pos) + EXT2_BLOCK_SIZE (data) - 1) / EXT2_BLOCK_SIZE (data); @@ -258,8 +258,8 @@ pupa_ext2_read_file (struct pupa_ext2_data *data, int skipfirst = 0; - pupa_ext2_get_file_block (data, i, &blknr); - if (pupa_errno) + grub_ext2_get_file_block (data, i, &blknr); + if (grub_errno) return -1; blknr = blknr << LOG2_EXT2_BLOCK_SIZE (data); @@ -286,14 +286,14 @@ pupa_ext2_read_file (struct pupa_ext2_data *data, if (blknr) { data->disk->read_hook = read_hook; - pupa_disk_read (data->disk, blknr, skipfirst, + grub_disk_read (data->disk, blknr, skipfirst, blockend, buf); data->disk->read_hook = 0; - if (pupa_errno) + if (grub_errno) return -1; } else - pupa_memset (buf, EXT2_BLOCK_SIZE (data) - skipfirst, 0); + grub_memset (buf, EXT2_BLOCK_SIZE (data) - skipfirst, 0); buf += EXT2_BLOCK_SIZE (data) - skipfirst; } @@ -303,12 +303,12 @@ pupa_ext2_read_file (struct pupa_ext2_data *data, /* Read the inode INO for the file described by DATA into INODE. */ -static pupa_err_t -pupa_ext2_read_inode (struct pupa_ext2_data *data, - int ino, struct pupa_ext2_inode *inode) +static grub_err_t +grub_ext2_read_inode (struct grub_ext2_data *data, + int ino, struct grub_ext2_inode *inode) { struct ext2_block_group blkgrp; - struct pupa_ext_sblock *sblock = &data->sblock; + struct grub_ext_sblock *sblock = &data->sblock; int inodes_per_block; unsigned int blkno; @@ -317,76 +317,76 @@ pupa_ext2_read_inode (struct pupa_ext2_data *data, /* It is easier to calculate if the first inode is 0. */ ino--; - pupa_ext2_blockgroup (data, ino / pupa_le_to_cpu32 (sblock->inodes_per_group), + grub_ext2_blockgroup (data, ino / grub_le_to_cpu32 (sblock->inodes_per_group), &blkgrp); - if (pupa_errno) - return pupa_errno; + if (grub_errno) + return grub_errno; inodes_per_block = EXT2_BLOCK_SIZE (data) / 128; - blkno = (ino % pupa_le_to_cpu32 (sblock->inodes_per_group)) + blkno = (ino % grub_le_to_cpu32 (sblock->inodes_per_group)) / inodes_per_block; - blkoff = (ino % pupa_le_to_cpu32 (sblock->inodes_per_group)) + blkoff = (ino % grub_le_to_cpu32 (sblock->inodes_per_group)) % inodes_per_block; /* Read the inode. */ - if (pupa_disk_read (data->disk, - ((pupa_le_to_cpu32 (blkgrp.inode_table_id) + blkno) + if (grub_disk_read (data->disk, + ((grub_le_to_cpu32 (blkgrp.inode_table_id) + blkno) << LOG2_EXT2_BLOCK_SIZE (data)), - sizeof (struct pupa_ext2_inode) * blkoff, - sizeof (struct pupa_ext2_inode), (char *) inode)) - return pupa_errno; + sizeof (struct grub_ext2_inode) * blkoff, + sizeof (struct grub_ext2_inode), (char *) inode)) + return grub_errno; return 0; } -static struct pupa_ext2_data * -pupa_ext2_mount (pupa_disk_t disk) +static struct grub_ext2_data * +grub_ext2_mount (grub_disk_t disk) { - struct pupa_ext2_data *data; + struct grub_ext2_data *data; - data = pupa_malloc (sizeof (struct pupa_ext2_data)); + data = grub_malloc (sizeof (struct grub_ext2_data)); if (!data) return 0; /* Read the superblock. */ - pupa_disk_read (disk, 1 * 2, 0, sizeof (struct pupa_ext_sblock), + grub_disk_read (disk, 1 * 2, 0, sizeof (struct grub_ext_sblock), (char *) &data->sblock); - if (pupa_errno) + if (grub_errno) goto fail; /* Make sure this is an ext2 filesystem. */ - if (pupa_le_to_cpu16 (data->sblock.magic) != EXT2_MAGIC) + if (grub_le_to_cpu16 (data->sblock.magic) != EXT2_MAGIC) goto fail; data->disk = disk; return data; fail: - pupa_error (PUPA_ERR_BAD_FS, "not an ext2 filesystem"); - pupa_free (data); + grub_error (GRUB_ERR_BAD_FS, "not an ext2 filesystem"); + grub_free (data); return 0; } /* Find the file with the pathname PATH on the filesystem described by DATA. Return its inode number in INO. */ -static pupa_err_t -pupa_ext2_find_file (struct pupa_ext2_data *data, const char *path, int *ino) +static grub_err_t +grub_ext2_find_file (struct grub_ext2_data *data, const char *path, int *ino) { int blocksize = EXT2_BLOCK_SIZE (data) - << pupa_le_to_cpu32 (data->sblock.log2_block_size); - struct pupa_ext2_inode *inode = &data->inode; + << grub_le_to_cpu32 (data->sblock.log2_block_size); + struct grub_ext2_inode *inode = &data->inode; int currinode = 2; int symlinkcnt = 0; char fpath[EXT2_PATH_MAX]; char *name = fpath; - pupa_strncpy (fpath, path, EXT2_PATH_MAX); + grub_strncpy (fpath, path, EXT2_PATH_MAX); if (!name || name[0] != '/') { - pupa_error (PUPA_ERR_BAD_FILENAME, "bad filename"); - return pupa_errno; + grub_error (GRUB_ERR_BAD_FILENAME, "bad filename"); + return grub_errno; } /* Skip the first slash. */ @@ -398,8 +398,8 @@ pupa_ext2_find_file (struct pupa_ext2_data *data, const char *path, int *ino) } /* Remove trailing "/". */ - if (name[pupa_strlen (name) - 1] =='/') - name[pupa_strlen (name) - 1] = '\0'; + if (name[grub_strlen (name) - 1] =='/') + name[grub_strlen (name) - 1] = '\0'; while (*name) { @@ -408,29 +408,29 @@ pupa_ext2_find_file (struct pupa_ext2_data *data, const char *path, int *ino) int namesize; /* Extract the actual part from the pathname. */ - next = pupa_strchr (name, '/'); + next = grub_strchr (name, '/'); if (next) { next[0] = '\0'; next++; } - namesize = pupa_strlen (name); + namesize = grub_strlen (name); /* Open the file. */ - pupa_ext2_read_inode (data, currinode, inode); - if (pupa_errno) + grub_ext2_read_inode (data, currinode, inode); + if (grub_errno) goto fail; /* Search the file. */ - while (fpos < pupa_le_to_cpu32 (inode->size)) + while (fpos < grub_le_to_cpu32 (inode->size)) { struct ext2_dirent dirent; /* Read the directory entry. */ - pupa_ext2_read_file (data, 0, fpos, sizeof (struct ext2_dirent), + grub_ext2_read_file (data, 0, fpos, sizeof (struct ext2_dirent), (char *) &dirent); - if (pupa_errno) + if (grub_errno) goto fail; if (dirent.namelen != 0) @@ -438,10 +438,10 @@ pupa_ext2_find_file (struct pupa_ext2_data *data, const char *path, int *ino) char filename[dirent.namelen + 1]; /* Read the filename part of this directory entry. */ - pupa_ext2_read_file (data, 0, fpos + grub_ext2_read_file (data, 0, fpos + sizeof (struct ext2_dirent), dirent.namelen, filename); - if (pupa_errno) + if (grub_errno) goto fail; filename[dirent.namelen] = '\0'; @@ -449,7 +449,7 @@ pupa_ext2_find_file (struct pupa_ext2_data *data, const char *path, int *ino) /* Check if the current directory entry described the file we are looking for. */ if (dirent.namelen == namesize - && !pupa_strncmp (name, filename, namesize)) + && !grub_strncmp (name, filename, namesize)) { /* If this is a symlink, follow it. */ if (dirent.filetype == FILETYPE_SYMLINK) @@ -459,38 +459,38 @@ pupa_ext2_find_file (struct pupa_ext2_data *data, const char *path, int *ino) if (++symlinkcnt == EXT2_MAX_SYMLINKCNT) { - pupa_error (PUPA_ERR_SYMLINK_LOOP, + grub_error (GRUB_ERR_SYMLINK_LOOP, "too deep nesting of symlinks"); goto fail; } /* Read the symlink. */ - pupa_ext2_read_inode (data, - pupa_le_to_cpu32 (dirent.inode), + grub_ext2_read_inode (data, + grub_le_to_cpu32 (dirent.inode), inode); /* If the filesize of the symlink is bigger than 60 the symlink is stored in a separate block, otherwise it is stored in the inode. */ - if (pupa_le_to_cpu32 (inode->size) <= 60) - pupa_strncpy (symlink, + if (grub_le_to_cpu32 (inode->size) <= 60) + grub_strncpy (symlink, inode->symlink, - pupa_le_to_cpu32 (inode->size)); + grub_le_to_cpu32 (inode->size)); else { - pupa_ext2_read_file (data, 0, 0, - pupa_le_to_cpu32 (inode->size), + grub_ext2_read_file (data, 0, 0, + grub_le_to_cpu32 (inode->size), symlink); - if (pupa_errno) + if (grub_errno) goto fail; } - symlink[pupa_le_to_cpu32 (inode->size)] = '\0'; + symlink[grub_le_to_cpu32 (inode->size)] = '\0'; /* Check if the symlink is absolute or relative. */ if (symlink[0] == '/') { - pupa_strncpy (fpath, symlink, EXT2_PATH_MAX); + grub_strncpy (fpath, symlink, EXT2_PATH_MAX); name = fpath; currinode = 2; } @@ -500,20 +500,20 @@ pupa_ext2_find_file (struct pupa_ext2_data *data, const char *path, int *ino) if (next) { - bak = pupa_strdup (next); + bak = grub_strdup (next); if (!bak) goto fail; } /* Relative symlink, construct the new path. */ - pupa_strcpy (fpath, symlink); + grub_strcpy (fpath, symlink); name = fpath; if (next) { - pupa_strcat (name, "/"); - pupa_strcat (name, bak); - pupa_free (bak); + grub_strcat (name, "/"); + grub_strcat (name, bak); + grub_free (bak); } } @@ -523,12 +523,12 @@ pupa_ext2_find_file (struct pupa_ext2_data *data, const char *path, int *ino) if (next) { - currinode = pupa_le_to_cpu32 (dirent.inode); + currinode = grub_le_to_cpu32 (dirent.inode); name = next; if (dirent.filetype != FILETYPE_DIRECTORY) { - pupa_error (PUPA_ERR_BAD_FILE_TYPE, + grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory"); goto fail; } @@ -536,59 +536,59 @@ pupa_ext2_find_file (struct pupa_ext2_data *data, const char *path, int *ino) } else /* Found it! */ { - *ino = pupa_le_to_cpu32 (dirent.inode); + *ino = grub_le_to_cpu32 (dirent.inode); return 0; } } } /* Move to next directory entry. */ - fpos += pupa_le_to_cpu16 (dirent.direntlen); + fpos += grub_le_to_cpu16 (dirent.direntlen); } /* The complete directory was read and no matching file was found. */ - if (fpos >= pupa_le_to_cpu32 (inode->size)) + if (fpos >= grub_le_to_cpu32 (inode->size)) { - pupa_error (PUPA_ERR_FILE_NOT_FOUND, "file not found"); + grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found"); goto fail; } } fail: - return pupa_errno; + return grub_errno; } /* Open a file named NAME and initialize FILE. */ -static pupa_err_t -pupa_ext2_open (struct pupa_file *file, const char *name) +static grub_err_t +grub_ext2_open (struct grub_file *file, const char *name) { - struct pupa_ext2_data *data; + struct grub_ext2_data *data; int ino; -#ifndef PUPA_UTIL - pupa_dl_ref (my_mod); +#ifndef GRUB_UTIL + grub_dl_ref (my_mod); #endif - data = pupa_ext2_mount (file->device->disk); + data = grub_ext2_mount (file->device->disk); if (!data) goto fail; - pupa_ext2_find_file (data, name, &ino); - if (pupa_errno) + grub_ext2_find_file (data, name, &ino); + if (grub_errno) goto fail; - pupa_ext2_read_inode (data, ino, &data->inode); - if (pupa_errno) + grub_ext2_read_inode (data, ino, &data->inode); + if (grub_errno) goto fail; - if (!(pupa_le_to_cpu16 (data->inode.mode) & 0100000)) + if (!(grub_le_to_cpu16 (data->inode.mode) & 0100000)) { - pupa_error (PUPA_ERR_BAD_FILE_TYPE, "not a regular file"); + grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a regular file"); goto fail; } - file->size = pupa_le_to_cpu32 (data->inode.size); + file->size = grub_le_to_cpu32 (data->inode.size); file->data = data; file->offset = 0; @@ -596,86 +596,86 @@ pupa_ext2_open (struct pupa_file *file, const char *name) fail: - pupa_free (data); + grub_free (data); -#ifndef PUPA_UTIL - pupa_dl_unref (my_mod); +#ifndef GRUB_UTIL + grub_dl_unref (my_mod); #endif - return pupa_errno; + return grub_errno; } -static pupa_err_t -pupa_ext2_close (pupa_file_t file) +static grub_err_t +grub_ext2_close (grub_file_t file) { - pupa_free (file->data); + grub_free (file->data); -#ifndef PUPA_UTIL - pupa_dl_unref (my_mod); +#ifndef GRUB_UTIL + grub_dl_unref (my_mod); #endif - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } /* Read LEN bytes data from FILE into BUF. */ -static pupa_ssize_t -pupa_ext2_read (pupa_file_t file, char *buf, pupa_ssize_t len) +static grub_ssize_t +grub_ext2_read (grub_file_t file, char *buf, grub_ssize_t len) { - struct pupa_ext2_data *data = - (struct pupa_ext2_data *) file->data; + struct grub_ext2_data *data = + (struct grub_ext2_data *) file->data; - return pupa_ext2_read_file (data, file->read_hook, file->offset, len, buf); + return grub_ext2_read_file (data, file->read_hook, file->offset, len, buf); } -static pupa_err_t -pupa_ext2_dir (pupa_device_t device, const char *path, +static grub_err_t +grub_ext2_dir (grub_device_t device, const char *path, int (*hook) (const char *filename, int dir)) { - struct pupa_ext2_data *data = 0;; + struct grub_ext2_data *data = 0;; int ino; unsigned int fpos = 0; -#ifndef PUPA_UTIL - pupa_dl_ref (my_mod); +#ifndef GRUB_UTIL + grub_dl_ref (my_mod); #endif - data = pupa_ext2_mount (device->disk); + data = grub_ext2_mount (device->disk); if (!data) goto fail; - pupa_ext2_find_file (data, (char *) path, &ino); - if (pupa_errno) + grub_ext2_find_file (data, (char *) path, &ino); + if (grub_errno) goto fail; - pupa_ext2_read_inode (data, ino, &data->inode); - if (pupa_errno) + grub_ext2_read_inode (data, ino, &data->inode); + if (grub_errno) goto fail; - if (!(pupa_le_to_cpu16 (data->inode.mode) & 040000)) + if (!(grub_le_to_cpu16 (data->inode.mode) & 040000)) { - pupa_error (PUPA_ERR_BAD_FILE_TYPE, "not a directory"); + grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory"); goto fail; } /* Search the file. */ - while (fpos < pupa_le_to_cpu32 (data->inode.size)) + while (fpos < grub_le_to_cpu32 (data->inode.size)) { struct ext2_dirent dirent; - pupa_ext2_read_file (data, 0, fpos, sizeof (struct ext2_dirent), + grub_ext2_read_file (data, 0, fpos, sizeof (struct ext2_dirent), (char *) &dirent); - if (pupa_errno) + if (grub_errno) goto fail; if (dirent.namelen != 0) { char filename[dirent.namelen + 1]; - pupa_ext2_read_file (data, 0, fpos + sizeof (struct ext2_dirent), + grub_ext2_read_file (data, 0, fpos + sizeof (struct ext2_dirent), dirent.namelen, filename); - if (pupa_errno) + if (grub_errno) goto fail; filename[dirent.namelen] = '\0'; @@ -683,78 +683,78 @@ pupa_ext2_dir (pupa_device_t device, const char *path, hook (filename, dirent.filetype == FILETYPE_DIRECTORY); } - fpos += pupa_le_to_cpu16 (dirent.direntlen); + fpos += grub_le_to_cpu16 (dirent.direntlen); } fail: - pupa_free (data); + grub_free (data); -#ifndef PUPA_UTIL - pupa_dl_unref (my_mod); +#ifndef GRUB_UTIL + grub_dl_unref (my_mod); #endif - return pupa_errno; + return grub_errno; } -static pupa_err_t -pupa_ext2_label (pupa_device_t device, char **label) +static grub_err_t +grub_ext2_label (grub_device_t device, char **label) { - struct pupa_ext2_data *data; - pupa_disk_t disk = device->disk; + struct grub_ext2_data *data; + grub_disk_t disk = device->disk; -#ifndef PUPA_UTIL - pupa_dl_ref (my_mod); +#ifndef GRUB_UTIL + grub_dl_ref (my_mod); #endif - data = pupa_ext2_mount (disk); + data = grub_ext2_mount (disk); if (data) - *label = pupa_strndup (data->sblock.volume_name, 14); + *label = grub_strndup (data->sblock.volume_name, 14); else *label = 0; -#ifndef PUPA_UTIL - pupa_dl_unref (my_mod); +#ifndef GRUB_UTIL + grub_dl_unref (my_mod); #endif - pupa_free (data); + grub_free (data); - return pupa_errno; + return grub_errno; } -static struct pupa_fs pupa_ext2_fs = +static struct grub_fs grub_ext2_fs = { .name = "ext2", - .dir = pupa_ext2_dir, - .open = pupa_ext2_open, - .read = pupa_ext2_read, - .close = pupa_ext2_close, - .label = pupa_ext2_label, + .dir = grub_ext2_dir, + .open = grub_ext2_open, + .read = grub_ext2_read, + .close = grub_ext2_close, + .label = grub_ext2_label, .next = 0 }; -#ifdef PUPA_UTIL +#ifdef GRUB_UTIL void -pupa_ext2_init (void) +grub_ext2_init (void) { - pupa_fs_register (&pupa_ext2_fs); + grub_fs_register (&grub_ext2_fs); } void -pupa_ext2_fini (void) +grub_ext2_fini (void) { - pupa_fs_unregister (&pupa_ext2_fs); + grub_fs_unregister (&grub_ext2_fs); } -#else /* ! PUPA_UTIL */ -PUPA_MOD_INIT +#else /* ! GRUB_UTIL */ +GRUB_MOD_INIT { - pupa_fs_register (&pupa_ext2_fs); + grub_fs_register (&grub_ext2_fs); my_mod = mod; } -PUPA_MOD_FINI +GRUB_MOD_FINI { - pupa_fs_unregister (&pupa_ext2_fs); + grub_fs_unregister (&grub_ext2_fs); } -#endif /* ! PUPA_UTIL */ +#endif /* ! GRUB_UTIL */ diff --git a/fs/fat.c b/fs/fat.c index bb1a48cb9..4ce269eb6 100644 --- a/fs/fat.c +++ b/fs/fat.c @@ -1,6 +1,6 @@ /* fat.c - FAT filesystem */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2000,2001,2002,2003,2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,115 +18,115 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include -#define PUPA_FAT_DIR_ENTRY_SIZE 32 +#define GRUB_FAT_DIR_ENTRY_SIZE 32 -#define PUPA_FAT_ATTR_READ_ONLY 0x01 -#define PUPA_FAT_ATTR_HIDDEN 0x02 -#define PUPA_FAT_ATTR_SYSTEM 0x04 -#define PUPA_FAT_ATTR_VOLUME_ID 0x08 -#define PUPA_FAT_ATTR_DIRECTORY 0x10 -#define PUPA_FAT_ATTR_ARCHIVE 0x20 +#define GRUB_FAT_ATTR_READ_ONLY 0x01 +#define GRUB_FAT_ATTR_HIDDEN 0x02 +#define GRUB_FAT_ATTR_SYSTEM 0x04 +#define GRUB_FAT_ATTR_VOLUME_ID 0x08 +#define GRUB_FAT_ATTR_DIRECTORY 0x10 +#define GRUB_FAT_ATTR_ARCHIVE 0x20 -#define PUPA_FAT_ATTR_LONG_NAME (PUPA_FAT_ATTR_READ_ONLY \ - | PUPA_FAT_ATTR_HIDDEN \ - | PUPA_FAT_ATTR_SYSTEM \ - | PUPA_FAT_ATTR_VOLUME_ID) -#define PUPA_FAT_ATTR_VALID (PUPA_FAT_ATTR_READ_ONLY \ - | PUPA_FAT_ATTR_HIDDEN \ - | PUPA_FAT_ATTR_SYSTEM \ - | PUPA_FAT_ATTR_DIRECTORY \ - | PUPA_FAT_ATTR_ARCHIVE) +#define GRUB_FAT_ATTR_LONG_NAME (GRUB_FAT_ATTR_READ_ONLY \ + | GRUB_FAT_ATTR_HIDDEN \ + | GRUB_FAT_ATTR_SYSTEM \ + | GRUB_FAT_ATTR_VOLUME_ID) +#define GRUB_FAT_ATTR_VALID (GRUB_FAT_ATTR_READ_ONLY \ + | GRUB_FAT_ATTR_HIDDEN \ + | GRUB_FAT_ATTR_SYSTEM \ + | GRUB_FAT_ATTR_DIRECTORY \ + | GRUB_FAT_ATTR_ARCHIVE) -struct pupa_fat_bpb +struct grub_fat_bpb { - pupa_uint8_t jmp_boot[3]; - pupa_uint8_t oem_name[8]; - pupa_uint16_t bytes_per_sector; - pupa_uint8_t sectors_per_cluster; - pupa_uint16_t num_reserved_sectors; - pupa_uint8_t num_fats; - pupa_uint16_t num_root_entries; - pupa_uint16_t num_total_sectors_16; - pupa_uint8_t media; - pupa_uint16_t sectors_per_fat_16; - pupa_uint16_t sectors_per_track; - pupa_uint16_t num_heads; - pupa_uint32_t num_hidden_sectors; - pupa_uint32_t num_total_sectors_32; + grub_uint8_t jmp_boot[3]; + grub_uint8_t oem_name[8]; + grub_uint16_t bytes_per_sector; + grub_uint8_t sectors_per_cluster; + grub_uint16_t num_reserved_sectors; + grub_uint8_t num_fats; + grub_uint16_t num_root_entries; + grub_uint16_t num_total_sectors_16; + grub_uint8_t media; + grub_uint16_t sectors_per_fat_16; + grub_uint16_t sectors_per_track; + grub_uint16_t num_heads; + grub_uint32_t num_hidden_sectors; + grub_uint32_t num_total_sectors_32; /* The following fields are only used by FAT32. */ - pupa_uint32_t sectors_per_fat_32; - pupa_uint16_t extended_flags; - pupa_uint16_t fs_version; - pupa_uint32_t root_cluster; - pupa_uint16_t fs_info; - pupa_uint16_t backup_boot_sector; + grub_uint32_t sectors_per_fat_32; + grub_uint16_t extended_flags; + grub_uint16_t fs_version; + grub_uint32_t root_cluster; + grub_uint16_t fs_info; + grub_uint16_t backup_boot_sector; } __attribute__ ((packed)); -struct pupa_fat_dir_entry +struct grub_fat_dir_entry { - pupa_uint8_t name[11]; - pupa_uint8_t attr; - pupa_uint8_t nt_reserved; - pupa_uint8_t c_time_tenth; - pupa_uint16_t c_time; - pupa_uint16_t c_date; - pupa_uint16_t a_date; - pupa_uint16_t first_cluster_high; - pupa_uint16_t w_time; - pupa_uint16_t w_date; - pupa_uint16_t first_cluster_low; - pupa_uint32_t file_size; + grub_uint8_t name[11]; + grub_uint8_t attr; + grub_uint8_t nt_reserved; + grub_uint8_t c_time_tenth; + grub_uint16_t c_time; + grub_uint16_t c_date; + grub_uint16_t a_date; + grub_uint16_t first_cluster_high; + grub_uint16_t w_time; + grub_uint16_t w_date; + grub_uint16_t first_cluster_low; + grub_uint32_t file_size; } __attribute__ ((packed)); -struct pupa_fat_long_name_entry +struct grub_fat_long_name_entry { - pupa_uint8_t id; - pupa_uint16_t name1[5]; - pupa_uint8_t attr; - pupa_uint8_t reserved; - pupa_uint8_t checksum; - pupa_uint16_t name2[6]; - pupa_uint16_t first_cluster; - pupa_uint16_t name3[2]; + grub_uint8_t id; + grub_uint16_t name1[5]; + grub_uint8_t attr; + grub_uint8_t reserved; + grub_uint8_t checksum; + grub_uint16_t name2[6]; + grub_uint16_t first_cluster; + grub_uint16_t name3[2]; } __attribute__ ((packed)); -struct pupa_fat_data +struct grub_fat_data { int logical_sector_bits; - pupa_uint32_t num_sectors; + grub_uint32_t num_sectors; - pupa_uint16_t fat_sector; - pupa_uint32_t sectors_per_fat; + grub_uint16_t fat_sector; + grub_uint32_t sectors_per_fat; int fat_size; - pupa_uint32_t root_cluster; - pupa_uint32_t root_sector; - pupa_uint32_t num_root_sectors; + grub_uint32_t root_cluster; + grub_uint32_t root_sector; + grub_uint32_t num_root_sectors; int cluster_bits; - pupa_uint32_t cluster_eof_mark; - pupa_uint32_t cluster_sector; - pupa_uint32_t num_clusters; + grub_uint32_t cluster_eof_mark; + grub_uint32_t cluster_sector; + grub_uint32_t num_clusters; - pupa_uint8_t attr; - pupa_ssize_t file_size; - pupa_uint32_t file_cluster; - pupa_uint32_t cur_cluster_num; - pupa_uint32_t cur_cluster; + grub_uint8_t attr; + grub_ssize_t file_size; + grub_uint32_t file_cluster; + grub_uint32_t cur_cluster_num; + grub_uint32_t cur_cluster; }; -#ifndef PUPA_UTIL -static pupa_dl_t my_mod; +#ifndef GRUB_UTIL +static grub_dl_t my_mod; #endif static int @@ -146,30 +146,30 @@ fat_log2 (unsigned x) return i; } -static struct pupa_fat_data * -pupa_fat_mount (pupa_disk_t disk) +static struct grub_fat_data * +grub_fat_mount (grub_disk_t disk) { - struct pupa_fat_bpb bpb; - struct pupa_fat_data *data = 0; - pupa_uint32_t first_fat, magic; + struct grub_fat_bpb bpb; + struct grub_fat_data *data = 0; + grub_uint32_t first_fat, magic; if (! disk) goto fail; - data = (struct pupa_fat_data *) pupa_malloc (sizeof (*data)); + data = (struct grub_fat_data *) grub_malloc (sizeof (*data)); if (! data) goto fail; /* Read the BPB. */ - if (pupa_disk_read (disk, 0, 0, sizeof (bpb), (char *) &bpb)) + if (grub_disk_read (disk, 0, 0, sizeof (bpb), (char *) &bpb)) goto fail; /* Get the sizes of logical sectors and clusters. */ data->logical_sector_bits = - fat_log2 (pupa_le_to_cpu16 (bpb.bytes_per_sector)); - if (data->logical_sector_bits < PUPA_DISK_SECTOR_BITS) + fat_log2 (grub_le_to_cpu16 (bpb.bytes_per_sector)); + if (data->logical_sector_bits < GRUB_DISK_SECTOR_BITS) goto fail; - data->logical_sector_bits -= PUPA_DISK_SECTOR_BITS; + data->logical_sector_bits -= GRUB_DISK_SECTOR_BITS; data->cluster_bits = fat_log2 (bpb.sectors_per_cluster); if (data->cluster_bits < 0) @@ -177,22 +177,22 @@ pupa_fat_mount (pupa_disk_t disk) data->cluster_bits += data->logical_sector_bits; /* Get information about FATs. */ - data->fat_sector = (pupa_le_to_cpu16 (bpb.num_reserved_sectors) + data->fat_sector = (grub_le_to_cpu16 (bpb.num_reserved_sectors) << data->logical_sector_bits); if (data->fat_sector == 0) goto fail; data->sectors_per_fat = ((bpb.sectors_per_fat_16 - ? pupa_le_to_cpu16 (bpb.sectors_per_fat_16) - : pupa_le_to_cpu32 (bpb.sectors_per_fat_32)) + ? grub_le_to_cpu16 (bpb.sectors_per_fat_16) + : grub_le_to_cpu32 (bpb.sectors_per_fat_32)) << data->logical_sector_bits); if (data->sectors_per_fat == 0) goto fail; /* Get the number of sectors in this volume. */ data->num_sectors = ((bpb.num_total_sectors_16 - ? pupa_le_to_cpu16 (bpb.num_total_sectors_16) - : pupa_le_to_cpu32 (bpb.num_total_sectors_32)) + ? grub_le_to_cpu16 (bpb.num_total_sectors_16) + : grub_le_to_cpu32 (bpb.num_total_sectors_32)) << data->logical_sector_bits); if (data->num_sectors == 0) goto fail; @@ -203,10 +203,10 @@ pupa_fat_mount (pupa_disk_t disk) data->root_sector = data->fat_sector + bpb.num_fats * data->sectors_per_fat; data->num_root_sectors - = ((((pupa_uint32_t) pupa_le_to_cpu16 (bpb.num_root_entries) - * PUPA_FAT_DIR_ENTRY_SIZE - + pupa_le_to_cpu16 (bpb.bytes_per_sector) - 1) - >> (data->logical_sector_bits + PUPA_DISK_SECTOR_BITS)) + = ((((grub_uint32_t) grub_le_to_cpu16 (bpb.num_root_entries) + * GRUB_FAT_DIR_ENTRY_SIZE + + grub_le_to_cpu16 (bpb.bytes_per_sector) - 1) + >> (data->logical_sector_bits + GRUB_DISK_SECTOR_BITS)) << (data->logical_sector_bits)); data->cluster_sector = data->root_sector + data->num_root_sectors; @@ -220,9 +220,9 @@ pupa_fat_mount (pupa_disk_t disk) if (! bpb.sectors_per_fat_16) { /* FAT32. */ - pupa_uint16_t flags = pupa_le_to_cpu16 (bpb.extended_flags); + grub_uint16_t flags = grub_le_to_cpu16 (bpb.extended_flags); - data->root_cluster = pupa_le_to_cpu32 (bpb.root_cluster); + data->root_cluster = grub_le_to_cpu32 (bpb.root_cluster); data->fat_size = 32; data->cluster_eof_mark = 0x0ffffff8; @@ -263,14 +263,14 @@ pupa_fat_mount (pupa_disk_t disk) if (data->num_sectors <= data->fat_sector) goto fail; - if (pupa_disk_read (disk, + if (grub_disk_read (disk, data->fat_sector, 0, sizeof (first_fat), (char *) &first_fat)) goto fail; - first_fat = pupa_le_to_cpu32 (first_fat); + first_fat = grub_le_to_cpu32 (first_fat); if (data->fat_size == 32) { @@ -294,26 +294,26 @@ pupa_fat_mount (pupa_disk_t disk) /* Start from the root directory. */ data->file_cluster = data->root_cluster; data->cur_cluster_num = ~0UL; - data->attr = PUPA_FAT_ATTR_DIRECTORY; + data->attr = GRUB_FAT_ATTR_DIRECTORY; return data; fail: - pupa_free (data); - pupa_error (PUPA_ERR_BAD_FS, "not a fat filesystem"); + grub_free (data); + grub_error (GRUB_ERR_BAD_FS, "not a fat filesystem"); return 0; } /* Convert UTF-16 (little endian) to UTF8. */ -static pupa_uint8_t * -pupa_fat_utf16_to_utf8 (pupa_uint8_t *dest, pupa_uint16_t *src, - pupa_size_t size) +static grub_uint8_t * +grub_fat_utf16_to_utf8 (grub_uint8_t *dest, grub_uint16_t *src, + grub_size_t size) { - pupa_uint32_t code_high = 0; + grub_uint32_t code_high = 0; while (size--) { - pupa_uint32_t code = pupa_le_to_cpu16 (*src++); + grub_uint32_t code = grub_le_to_cpu16 (*src++); if (code_high) { @@ -366,27 +366,27 @@ pupa_fat_utf16_to_utf8 (pupa_uint8_t *dest, pupa_uint16_t *src, return dest; } -static pupa_ssize_t -pupa_fat_read_data (pupa_disk_t disk, struct pupa_fat_data *data, +static grub_ssize_t +grub_fat_read_data (grub_disk_t disk, struct grub_fat_data *data, void (*read_hook) (unsigned long sector, unsigned offset, unsigned length), - pupa_ssize_t offset, pupa_ssize_t len, char *buf) + grub_ssize_t offset, grub_ssize_t len, char *buf) { - pupa_ssize_t size; - pupa_uint32_t logical_cluster; + grub_ssize_t size; + grub_uint32_t logical_cluster; unsigned logical_cluster_bits; - pupa_ssize_t ret = 0; + grub_ssize_t ret = 0; unsigned long sector; /* This is a special case. FAT12 and FAT16 doesn't have the root directory in clusters. */ if (data->file_cluster == ~0UL) { - size = (data->num_root_sectors << PUPA_DISK_SECTOR_BITS) - offset; + size = (data->num_root_sectors << GRUB_DISK_SECTOR_BITS) - offset; if (size > len) size = len; - if (pupa_disk_read (disk, data->root_sector, offset, size, buf)) + if (grub_disk_read (disk, data->root_sector, offset, size, buf)) return -1; return size; @@ -395,7 +395,7 @@ pupa_fat_read_data (pupa_disk_t disk, struct pupa_fat_data *data, /* Calculate the logical cluster number and offset. */ logical_cluster_bits = (data->cluster_bits + data->logical_sector_bits - + PUPA_DISK_SECTOR_BITS); + + GRUB_DISK_SECTOR_BITS); logical_cluster = offset >> logical_cluster_bits; offset &= (1 << logical_cluster_bits) - 1; @@ -410,7 +410,7 @@ pupa_fat_read_data (pupa_disk_t disk, struct pupa_fat_data *data, while (logical_cluster > data->cur_cluster_num) { /* Find next cluster. */ - pupa_uint32_t next_cluster; + grub_uint32_t next_cluster; unsigned long fat_offset; switch (data->fat_size) @@ -428,12 +428,12 @@ pupa_fat_read_data (pupa_disk_t disk, struct pupa_fat_data *data, } /* Read the FAT. */ - if (pupa_disk_read (disk, data->fat_sector, fat_offset, + if (grub_disk_read (disk, data->fat_sector, fat_offset, (data->fat_size + 7) >> 3, (char *) &next_cluster)) return -1; - next_cluster = pupa_le_to_cpu32 (next_cluster); + next_cluster = grub_le_to_cpu32 (next_cluster); switch (data->fat_size) { case 16: @@ -448,7 +448,7 @@ pupa_fat_read_data (pupa_disk_t disk, struct pupa_fat_data *data, } #if 0 - pupa_printf ("%s:%d: fat_size=%d, next_cluster=%u\n", + grub_printf ("%s:%d: fat_size=%d, next_cluster=%u\n", __FILE__, __LINE__, data->fat_size, next_cluster); #endif @@ -458,7 +458,7 @@ pupa_fat_read_data (pupa_disk_t disk, struct pupa_fat_data *data, if (next_cluster < 2 || next_cluster >= data->num_clusters) { - pupa_error (PUPA_ERR_BAD_FS, "invalid cluster %u", + grub_error (GRUB_ERR_BAD_FS, "invalid cluster %u", next_cluster); return -1; } @@ -476,9 +476,9 @@ pupa_fat_read_data (pupa_disk_t disk, struct pupa_fat_data *data, size = len; disk->read_hook = read_hook; - pupa_disk_read (disk, sector, offset, size, buf); + grub_disk_read (disk, sector, offset, size, buf); disk->read_hook = 0; - if (pupa_errno) + if (grub_errno) return -1; len -= size; @@ -495,22 +495,22 @@ pupa_fat_read_data (pupa_disk_t disk, struct pupa_fat_data *data, next path. If there is no next path or an error occurs, return NULL. If HOOK is specified, call it with each file name. */ static char * -pupa_fat_find_dir (pupa_disk_t disk, struct pupa_fat_data *data, +grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data, const char *path, int (*hook) (const char *filename, int dir)) { - struct pupa_fat_dir_entry dir; + struct grub_fat_dir_entry dir; char *dirname, *dirp; char *filename, *filep = 0; - pupa_uint16_t *unibuf; + grub_uint16_t *unibuf; int slot = -1, slots = -1; int checksum = -1; - pupa_ssize_t offset = -sizeof(dir); + grub_ssize_t offset = -sizeof(dir); int call_hook; - if (! (data->attr & PUPA_FAT_ATTR_DIRECTORY)) + if (! (data->attr & GRUB_FAT_ATTR_DIRECTORY)) { - pupa_error (PUPA_ERR_BAD_FILE_TYPE, "not a directory"); + grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory"); return 0; } @@ -518,32 +518,32 @@ pupa_fat_find_dir (pupa_disk_t disk, struct pupa_fat_data *data, while (*path == '/') path++; - dirp = pupa_strchr (path, '/'); + dirp = grub_strchr (path, '/'); if (dirp) { unsigned len = dirp - path; - dirname = pupa_malloc (len + 1); + dirname = grub_malloc (len + 1); if (! dirname) return 0; - pupa_memcpy (dirname, path, len); + grub_memcpy (dirname, path, len); dirname[len] = '\0'; } else /* This is actually a file. */ - dirname = pupa_strdup (path); + dirname = grub_strdup (path); call_hook = (! dirp && hook); /* Allocate space enough to hold a long name. */ - filename = pupa_malloc (0x40 * 13 * 4 + 1); - unibuf = (pupa_uint16_t *) pupa_malloc (0x40 * 13 * 2); + filename = grub_malloc (0x40 * 13 * 4 + 1); + unibuf = (grub_uint16_t *) grub_malloc (0x40 * 13 * 2); if (! filename || ! unibuf) { - pupa_free (filename); - pupa_free (unibuf); - pupa_free (dirname); + grub_free (filename); + grub_free (unibuf); + grub_free (dirname); return 0; } @@ -555,23 +555,23 @@ pupa_fat_find_dir (pupa_disk_t disk, struct pupa_fat_data *data, offset += sizeof (dir); /* Read a directory entry. */ - if ((pupa_fat_read_data (disk, data, 0, + if ((grub_fat_read_data (disk, data, 0, offset, sizeof (dir), (char *) &dir) != sizeof (dir)) || dir.name[0] == 0) { - if (pupa_errno == PUPA_ERR_NONE && ! call_hook) - pupa_error (PUPA_ERR_FILE_NOT_FOUND, "file not found"); + if (grub_errno == GRUB_ERR_NONE && ! call_hook) + grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found"); break; } /* Handle long name entries. */ - if (dir.attr == PUPA_FAT_ATTR_LONG_NAME) + if (dir.attr == GRUB_FAT_ATTR_LONG_NAME) { - struct pupa_fat_long_name_entry *long_name - = (struct pupa_fat_long_name_entry *) &dir; - pupa_uint8_t id = long_name->id; + struct grub_fat_long_name_entry *long_name + = (struct grub_fat_long_name_entry *) &dir; + grub_uint8_t id = long_name->id; if (id & 0x40) { @@ -587,14 +587,14 @@ pupa_fat_find_dir (pupa_disk_t disk, struct pupa_fat_data *data, } slot--; - pupa_memcpy (unibuf + slot * 13, long_name->name1, 5 * 2); - pupa_memcpy (unibuf + slot * 13 + 5, long_name->name2, 6 * 2); - pupa_memcpy (unibuf + slot * 13 + 11, long_name->name3, 2 * 2); + grub_memcpy (unibuf + slot * 13, long_name->name1, 5 * 2); + grub_memcpy (unibuf + slot * 13 + 5, long_name->name2, 6 * 2); + grub_memcpy (unibuf + slot * 13 + 11, long_name->name3, 2 * 2); continue; } /* Check if this entry is valid. */ - if (dir.name[0] == 0xe5 || (dir.attr & ~PUPA_FAT_ATTR_VALID)) + if (dir.name[0] == 0xe5 || (dir.attr & ~GRUB_FAT_ATTR_VALID)) continue; /* This is a workaround for Japanese. */ @@ -603,28 +603,28 @@ pupa_fat_find_dir (pupa_disk_t disk, struct pupa_fat_data *data, if (checksum != -1 && slot == 0) { - pupa_uint8_t sum; + grub_uint8_t sum; for (sum = 0, i = 0; i < sizeof (dir.name); i++) sum = ((sum >> 1) | (sum << 7)) + dir.name[i]; if (sum == checksum) { - *pupa_fat_utf16_to_utf8 (filename, unibuf, slots * 13) = '\0'; + *grub_fat_utf16_to_utf8 (filename, unibuf, slots * 13) = '\0'; if (*dirname == '\0' && call_hook) { - if (hook (filename, dir.attr & PUPA_FAT_ATTR_DIRECTORY)) + if (hook (filename, dir.attr & GRUB_FAT_ATTR_DIRECTORY)) break; checksum = -1; continue; } - if (pupa_strcmp (dirname, filename) == 0) + if (grub_strcmp (dirname, filename) == 0) { if (call_hook) - hook (filename, dir.attr & PUPA_FAT_ATTR_DIRECTORY); + hook (filename, dir.attr & GRUB_FAT_ATTR_DIRECTORY); break; } @@ -636,13 +636,13 @@ pupa_fat_find_dir (pupa_disk_t disk, struct pupa_fat_data *data, /* Convert the 8.3 file name. */ filep = filename; - for (i = 0; i < 8 && dir.name[i] && ! pupa_isspace (dir.name[i]); i++) - *filep++ = pupa_tolower (dir.name[i]); + for (i = 0; i < 8 && dir.name[i] && ! grub_isspace (dir.name[i]); i++) + *filep++ = grub_tolower (dir.name[i]); *filep = '.'; - for (i = 8; i < 11 && dir.name[i] && ! pupa_isspace (dir.name[i]); i++) - *++filep = pupa_tolower (dir.name[i]); + for (i = 8; i < 11 && dir.name[i] && ! grub_isspace (dir.name[i]); i++) + *++filep = grub_tolower (dir.name[i]); if (*filep != '.') filep++; @@ -651,174 +651,174 @@ pupa_fat_find_dir (pupa_disk_t disk, struct pupa_fat_data *data, if (*dirname == '\0' && call_hook) { - if (hook (filename, dir.attr & PUPA_FAT_ATTR_DIRECTORY)) + if (hook (filename, dir.attr & GRUB_FAT_ATTR_DIRECTORY)) break; } - else if (pupa_strcmp (dirname, filename) == 0) + else if (grub_strcmp (dirname, filename) == 0) { if (call_hook) - hook (filename, dir.attr & PUPA_FAT_ATTR_DIRECTORY); + hook (filename, dir.attr & GRUB_FAT_ATTR_DIRECTORY); break; } } - pupa_free (filename); - pupa_free (dirname); + grub_free (filename); + grub_free (dirname); data->attr = dir.attr; - data->file_size = pupa_le_to_cpu32 (dir.file_size); - data->file_cluster = ((pupa_le_to_cpu16 (dir.first_cluster_high) << 16) - | pupa_le_to_cpu16 (dir.first_cluster_low)); + data->file_size = grub_le_to_cpu32 (dir.file_size); + data->file_cluster = ((grub_le_to_cpu16 (dir.first_cluster_high) << 16) + | grub_le_to_cpu16 (dir.first_cluster_low)); data->cur_cluster_num = ~0UL; return dirp; } -static pupa_err_t -pupa_fat_dir (pupa_device_t device, const char *path, +static grub_err_t +grub_fat_dir (grub_device_t device, const char *path, int (*hook) (const char *filename, int dir)) { - struct pupa_fat_data *data = 0; - pupa_disk_t disk = device->disk; + struct grub_fat_data *data = 0; + grub_disk_t disk = device->disk; char *p = (char *) path; -#ifndef PUPA_UTIL - pupa_dl_ref (my_mod); +#ifndef GRUB_UTIL + grub_dl_ref (my_mod); #endif - data = pupa_fat_mount (disk); + data = grub_fat_mount (disk); if (! data) goto fail; do { - p = pupa_fat_find_dir (disk, data, p, hook); + p = grub_fat_find_dir (disk, data, p, hook); } - while (p && pupa_errno == PUPA_ERR_NONE); + while (p && grub_errno == GRUB_ERR_NONE); fail: - pupa_free (data); + grub_free (data); -#ifndef PUPA_UTIL - pupa_dl_unref (my_mod); +#ifndef GRUB_UTIL + grub_dl_unref (my_mod); #endif - return pupa_errno; + return grub_errno; } -static pupa_err_t -pupa_fat_open (pupa_file_t file, const char *name) +static grub_err_t +grub_fat_open (grub_file_t file, const char *name) { - struct pupa_fat_data *data = 0; + struct grub_fat_data *data = 0; char *p = (char *) name; -#ifndef PUPA_UTIL - pupa_dl_ref (my_mod); +#ifndef GRUB_UTIL + grub_dl_ref (my_mod); #endif - data = pupa_fat_mount (file->device->disk); + data = grub_fat_mount (file->device->disk); if (! data) goto fail; do { - p = pupa_fat_find_dir (file->device->disk, data, p, 0); - if (pupa_errno != PUPA_ERR_NONE) + p = grub_fat_find_dir (file->device->disk, data, p, 0); + if (grub_errno != GRUB_ERR_NONE) goto fail; } while (p); - if (data->attr & PUPA_FAT_ATTR_DIRECTORY) + if (data->attr & GRUB_FAT_ATTR_DIRECTORY) { - pupa_error (PUPA_ERR_BAD_FILE_TYPE, "not a file"); + grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a file"); goto fail; } file->data = data; file->size = data->file_size; - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; fail: - pupa_free (data); + grub_free (data); -#ifndef PUPA_UTIL - pupa_dl_unref (my_mod); +#ifndef GRUB_UTIL + grub_dl_unref (my_mod); #endif - return pupa_errno; + return grub_errno; } -static pupa_ssize_t -pupa_fat_read (pupa_file_t file, char *buf, pupa_ssize_t len) +static grub_ssize_t +grub_fat_read (grub_file_t file, char *buf, grub_ssize_t len) { - return pupa_fat_read_data (file->device->disk, file->data, file->read_hook, + return grub_fat_read_data (file->device->disk, file->data, file->read_hook, file->offset, len, buf); } -static pupa_err_t -pupa_fat_close (pupa_file_t file) +static grub_err_t +grub_fat_close (grub_file_t file) { - pupa_free (file->data); + grub_free (file->data); -#ifndef PUPA_UTIL - pupa_dl_unref (my_mod); +#ifndef GRUB_UTIL + grub_dl_unref (my_mod); #endif - return pupa_errno; + return grub_errno; } -static pupa_err_t -pupa_fat_label (pupa_device_t device, char **label) +static grub_err_t +grub_fat_label (grub_device_t device, char **label) { - struct pupa_fat_data *data; - pupa_disk_t disk = device->disk; - pupa_ssize_t offset = -sizeof(struct pupa_fat_dir_entry); + struct grub_fat_data *data; + grub_disk_t disk = device->disk; + grub_ssize_t offset = -sizeof(struct grub_fat_dir_entry); -#ifndef PUPA_UTIL - pupa_dl_ref (my_mod); +#ifndef GRUB_UTIL + grub_dl_ref (my_mod); #endif - data = pupa_fat_mount (disk); + data = grub_fat_mount (disk); if (! data) goto fail; - if (! (data->attr & PUPA_FAT_ATTR_DIRECTORY)) + if (! (data->attr & GRUB_FAT_ATTR_DIRECTORY)) { - pupa_error (PUPA_ERR_BAD_FILE_TYPE, "not a directory"); + grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory"); return 0; } while (1) { - struct pupa_fat_dir_entry dir; + struct grub_fat_dir_entry dir; /* Adjust the offset. */ offset += sizeof (dir); /* Read a directory entry. */ - if ((pupa_fat_read_data (disk, data, 0, + if ((grub_fat_read_data (disk, data, 0, offset, sizeof (dir), (char *) &dir) != sizeof (dir)) || dir.name[0] == 0) { - if (pupa_errno != PUPA_ERR_NONE) + if (grub_errno != GRUB_ERR_NONE) goto fail; else { *label = 0; - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } } - if (dir.attr == PUPA_FAT_ATTR_VOLUME_ID) + if (dir.attr == GRUB_FAT_ATTR_VOLUME_ID) { - *label = pupa_strndup (dir.name, 11); - return PUPA_ERR_NONE; + *label = grub_strndup (dir.name, 11); + return GRUB_ERR_NONE; } } @@ -826,47 +826,47 @@ pupa_fat_label (pupa_device_t device, char **label) fail: -#ifndef PUPA_UTIL - pupa_dl_unref (my_mod); +#ifndef GRUB_UTIL + grub_dl_unref (my_mod); #endif - pupa_free (data); + grub_free (data); - return pupa_errno; + return grub_errno; } -static struct pupa_fs pupa_fat_fs = +static struct grub_fs grub_fat_fs = { .name = "fat", - .dir = pupa_fat_dir, - .open = pupa_fat_open, - .read = pupa_fat_read, - .close = pupa_fat_close, - .label = pupa_fat_label, + .dir = grub_fat_dir, + .open = grub_fat_open, + .read = grub_fat_read, + .close = grub_fat_close, + .label = grub_fat_label, .next = 0 }; -#ifdef PUPA_UTIL +#ifdef GRUB_UTIL void -pupa_fat_init (void) +grub_fat_init (void) { - pupa_fs_register (&pupa_fat_fs); + grub_fs_register (&grub_fat_fs); } void -pupa_fat_fini (void) +grub_fat_fini (void) { - pupa_fs_unregister (&pupa_fat_fs); + grub_fs_unregister (&grub_fat_fs); } -#else /* ! PUPA_UTIL */ -PUPA_MOD_INIT +#else /* ! GRUB_UTIL */ +GRUB_MOD_INIT { - pupa_fs_register (&pupa_fat_fs); + grub_fs_register (&grub_fat_fs); my_mod = mod; } -PUPA_MOD_FINI +GRUB_MOD_FINI { - pupa_fs_unregister (&pupa_fat_fs); + grub_fs_unregister (&grub_fat_fs); } -#endif /* ! PUPA_UTIL */ +#endif /* ! GRUB_UTIL */ diff --git a/genmk.rb b/genmk.rb index 2be1f81af..f02f21c56 100644 --- a/genmk.rb +++ b/genmk.rb @@ -118,7 +118,7 @@ UNDSYMFILES += #{undsym} #{@name}: #{pre_obj} #{mod_obj} -rm -f $@ $(LD) -r -o $@ $^ - $(STRIP) --strip-unneeded -K pupa_mod_init -K pupa_mod_fini -R .note -R .comment $@ + $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R .comment $@ #{pre_obj}: #{objs_str} -rm -f $@ @@ -190,11 +190,11 @@ MOSTLYCLEANFILES += #{deps_str} dir = File.dirname(src) "#{obj}: #{src} - $(BUILD_CC) -I#{dir} -I$(srcdir)/#{dir} $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(#{prefix}_CFLAGS) -c -o $@ $< + $(BUILD_CC) -I#{dir} -I$(srcdir)/#{dir} $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(#{prefix}_CFLAGS) -c -o $@ $< #{dep}: #{src} set -e; \ - $(BUILD_CC) -I#{dir} -I$(srcdir)/#{dir} $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DPUPA_UTIL=1 $(#{prefix}_CFLAGS) -M $< \ + $(BUILD_CC) -I#{dir} -I$(srcdir)/#{dir} $(BUILD_CPPFLAGS) $(BUILD_CFLAGS) -DGRUB_UTIL=1 $(#{prefix}_CFLAGS) -M $< \ | sed 's,#{Regexp.quote(fake_obj)}[ :]*,#{obj} $@ : ,g' > $@; \ [ -s $@ ] || rm -f $@ diff --git a/genmodsrc.sh b/genmodsrc.sh index 8bff6dd46..a116721ea 100644 --- a/genmodsrc.sh +++ b/genmodsrc.sh @@ -19,10 +19,10 @@ deps="$2" cat < +#include EOF -echo "PUPA_MOD_NAME(${mod_name});" +echo "GRUB_MOD_NAME(${mod_name});" for mod in `grep "^${mod_name}:" ${deps} | sed 's/^[^:]*://'`; do - echo "PUPA_MOD_DEP(${mod});" + echo "GRUB_MOD_DEP(${mod});" done diff --git a/gensymlist.sh b/gensymlist.sh index 6ac3996a2..c7e41a93d 100644 --- a/gensymlist.sh +++ b/gensymlist.sh @@ -14,10 +14,10 @@ cat <name; p++) - pupa_dl_register_symbol (p->name, p->addr, 0); + grub_dl_register_symbol (p->name, p->addr, 0); } EOF diff --git a/hello/hello.c b/hello/hello.c index 85fce150f..327473448 100644 --- a/hello/hello.c +++ b/hello/hello.c @@ -1,6 +1,6 @@ /* hello.c - test module for dynamic loading */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * Copyright (C) 2003 NIIBE Yutaka * @@ -19,30 +19,30 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include -static pupa_err_t -pupa_cmd_hello (struct pupa_arg_list *state __attribute__ ((unused)), +static grub_err_t +grub_cmd_hello (struct grub_arg_list *state __attribute__ ((unused)), int argc __attribute__ ((unused)), char **args __attribute__ ((unused))) { - pupa_printf ("Hello World\n"); + grub_printf ("Hello World\n"); return 0; } -PUPA_MOD_INIT +GRUB_MOD_INIT { (void)mod; /* To stop warning. */ - pupa_register_command ("hello", pupa_cmd_hello, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("hello", grub_cmd_hello, GRUB_COMMAND_FLAG_BOTH, "hello", "Say hello", 0); } -PUPA_MOD_FINI +GRUB_MOD_FINI { - pupa_unregister_command ("hello"); + grub_unregister_command ("hello"); } diff --git a/include/grub/arg.h b/include/grub/arg.h index c2572b3d1..d08177807 100644 --- a/include/grub/arg.h +++ b/include/grub/arg.h @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,18 +13,18 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_ARG_HEADER -#define PUPA_ARG_HEADER 1 +#ifndef GRUB_ARG_HEADER +#define GRUB_ARG_HEADER 1 -#include -#include -#include +#include +#include +#include -enum pupa_arg_type +enum grub_arg_type { ARG_TYPE_NONE, ARG_TYPE_STRING, @@ -35,32 +35,32 @@ enum pupa_arg_type ARG_TYPE_PATHNAME }; -typedef enum pupa_arg_type pupa_arg_type_t; +typedef enum grub_arg_type grub_arg_type_t; -/* Flags for the option field op pupa_arg_option. */ -#define PUPA_ARG_OPTION_OPTIONAL 1 << 1 +/* Flags for the option field op grub_arg_option. */ +#define GRUB_ARG_OPTION_OPTIONAL 1 << 1 -enum pupa_key_type +enum grub_key_type { - PUPA_KEY_ARG = -1, - PUPA_KEY_END = -2 + GRUB_KEY_ARG = -1, + GRUB_KEY_END = -2 }; -typedef enum pupa_key_type pupa_arg_key_type_t; +typedef enum grub_key_type grub_arg_key_type_t; -struct pupa_arg_option +struct grub_arg_option { char *longarg; char shortarg; int flags; char *doc; char *arg; - pupa_arg_type_t type; + grub_arg_type_t type; }; -struct pupa_arg_list +struct grub_arg_list { int set; char *arg; }; -#endif /* ! PUPA_ARG_HEADER */ +#endif /* ! GRUB_ARG_HEADER */ diff --git a/include/grub/boot.h b/include/grub/boot.h index 14eb7be12..08c4c34c3 100644 --- a/include/grub/boot.h +++ b/include/grub/boot.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,12 +17,12 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_BOOT_HEADER -#define PUPA_BOOT_HEADER 1 +#ifndef GRUB_BOOT_HEADER +#define GRUB_BOOT_HEADER 1 -#define PUPA_BOOT_VERSION_MAJOR 4 -#define PUPA_BOOT_VERSION_MINOR 0 -#define PUPA_BOOT_VERSION ((PUPA_BOOT_VERSION_MINOR << 8) \ - | PUPA_BOOT_VERSION_MAJOR) +#define GRUB_BOOT_VERSION_MAJOR 4 +#define GRUB_BOOT_VERSION_MINOR 0 +#define GRUB_BOOT_VERSION ((GRUB_BOOT_VERSION_MINOR << 8) \ + | GRUB_BOOT_VERSION_MAJOR) -#endif /* ! PUPA_BOOT_HEADER */ +#endif /* ! GRUB_BOOT_HEADER */ diff --git a/include/grub/device.h b/include/grub/device.h index a0dad3d28..5c1aedbc6 100644 --- a/include/grub/device.h +++ b/include/grub/device.h @@ -1,9 +1,9 @@ /* device.h - device manager */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,31 +14,31 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_DEVICE_HEADER -#define PUPA_DEVICE_HEADER 1 +#ifndef GRUB_DEVICE_HEADER +#define GRUB_DEVICE_HEADER 1 -#include -#include +#include +#include -struct pupa_disk; -struct pupa_net; -struct pupa_fs; +struct grub_disk; +struct grub_net; +struct grub_fs; -struct pupa_device +struct grub_device { - struct pupa_disk *disk; - struct pupa_net *net; + struct grub_disk *disk; + struct grub_net *net; }; -typedef struct pupa_device *pupa_device_t; +typedef struct grub_device *grub_device_t; -pupa_device_t EXPORT_FUNC(pupa_device_open) (const char *name); -pupa_err_t EXPORT_FUNC(pupa_device_close) (pupa_device_t device); +grub_device_t EXPORT_FUNC(grub_device_open) (const char *name); +grub_err_t EXPORT_FUNC(grub_device_close) (grub_device_t device); -pupa_err_t EXPORT_FUNC(pupa_device_set_root) (const char *name); -const char *EXPORT_FUNC(pupa_device_get_root) (void); +grub_err_t EXPORT_FUNC(grub_device_set_root) (const char *name); +const char *EXPORT_FUNC(grub_device_get_root) (void); -#endif /* ! PUPA_DEVICE_HEADER */ +#endif /* ! GRUB_DEVICE_HEADER */ diff --git a/include/grub/disk.h b/include/grub/disk.h index f09bcbf5c..698273580 100644 --- a/include/grub/disk.h +++ b/include/grub/disk.h @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002, 2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,22 +13,22 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_DISK_HEADER -#define PUPA_DISK_HEADER 1 +#ifndef GRUB_DISK_HEADER +#define GRUB_DISK_HEADER 1 -#include -#include -#include -#include +#include +#include +#include +#include -struct pupa_disk; +struct grub_disk; /* Disk device. */ -struct pupa_disk_dev +struct grub_disk_dev { /* The device name. */ const char *name; @@ -37,34 +37,34 @@ struct pupa_disk_dev int (*iterate) (int (*hook) (const char *name)); /* Open the device named NAME, and set up DISK. */ - pupa_err_t (*open) (const char *name, struct pupa_disk *disk); + grub_err_t (*open) (const char *name, struct grub_disk *disk); /* Close the disk DISK. */ - void (*close) (struct pupa_disk *disk); + void (*close) (struct grub_disk *disk); /* Read SIZE sectors from the sector SECTOR of the disk DISK into BUF. */ - pupa_err_t (*read) (struct pupa_disk *disk, unsigned long sector, + grub_err_t (*read) (struct grub_disk *disk, unsigned long sector, unsigned long size, char *buf); /* Write SIZE sectors from BUF into the sector SECTOR of the disk DISK. */ - pupa_err_t (*write) (struct pupa_disk *disk, unsigned long sector, + grub_err_t (*write) (struct grub_disk *disk, unsigned long sector, unsigned long size, const char *buf); /* The next disk device. */ - struct pupa_disk_dev *next; + struct grub_disk_dev *next; }; -typedef struct pupa_disk_dev *pupa_disk_dev_t; +typedef struct grub_disk_dev *grub_disk_dev_t; -struct pupa_partition; +struct grub_partition; /* Disk. */ -struct pupa_disk +struct grub_disk { /* The disk name. */ const char *name; /* The underlying disk device. */ - pupa_disk_dev_t dev; + grub_disk_dev_t dev; /* The total number of sectors. */ unsigned long total_sectors; @@ -76,7 +76,7 @@ struct pupa_disk unsigned long id; /* The partition information. This is machine-specific. */ - struct pupa_partition *partition; + struct grub_partition *partition; /* Called when a sector was read. */ void (*read_hook) (unsigned long sector, unsigned offset, unsigned length); @@ -84,40 +84,40 @@ struct pupa_disk /* Device-specific data. */ void *data; }; -typedef struct pupa_disk *pupa_disk_t; +typedef struct grub_disk *grub_disk_t; /* The sector size. */ -#define PUPA_DISK_SECTOR_SIZE 0x200 -#define PUPA_DISK_SECTOR_BITS 9 +#define GRUB_DISK_SECTOR_SIZE 0x200 +#define GRUB_DISK_SECTOR_BITS 9 /* The maximum number of disk caches. */ -#define PUPA_DISK_CACHE_NUM 1021 +#define GRUB_DISK_CACHE_NUM 1021 /* The size of a disk cache in sector units. */ -#define PUPA_DISK_CACHE_SIZE 8 -#define PUPA_DISK_CACHE_BITS 3 +#define GRUB_DISK_CACHE_SIZE 8 +#define GRUB_DISK_CACHE_BITS 3 /* This is called from the memory manager. */ -void pupa_disk_cache_invalidate_all (void); +void grub_disk_cache_invalidate_all (void); -void EXPORT_FUNC(pupa_disk_dev_register) (pupa_disk_dev_t dev); -void EXPORT_FUNC(pupa_disk_dev_unregister) (pupa_disk_dev_t dev); -void EXPORT_FUNC(pupa_disk_dev_iterate) (int (*hook) (const char *name)); +void EXPORT_FUNC(grub_disk_dev_register) (grub_disk_dev_t dev); +void EXPORT_FUNC(grub_disk_dev_unregister) (grub_disk_dev_t dev); +void EXPORT_FUNC(grub_disk_dev_iterate) (int (*hook) (const char *name)); -pupa_disk_t EXPORT_FUNC(pupa_disk_open) (const char *name); -void EXPORT_FUNC(pupa_disk_close) (pupa_disk_t disk); -pupa_err_t EXPORT_FUNC(pupa_disk_read) (pupa_disk_t disk, +grub_disk_t EXPORT_FUNC(grub_disk_open) (const char *name); +void EXPORT_FUNC(grub_disk_close) (grub_disk_t disk); +grub_err_t EXPORT_FUNC(grub_disk_read) (grub_disk_t disk, unsigned long sector, unsigned long offset, unsigned long size, char *buf); -pupa_err_t EXPORT_FUNC(pupa_disk_write) (pupa_disk_t disk, +grub_err_t EXPORT_FUNC(grub_disk_write) (grub_disk_t disk, unsigned long sector, unsigned long offset, unsigned long size, const char *buf); -pupa_err_t EXPORT_FUNC(pupa_print_partinfo) (pupa_device_t disk, +grub_err_t EXPORT_FUNC(grub_print_partinfo) (grub_device_t disk, char *partname); -#endif /* ! PUPA_DISK_HEADER */ +#endif /* ! GRUB_DISK_HEADER */ diff --git a/include/grub/dl.h b/include/grub/dl.h index 070bc4005..524f40f1b 100644 --- a/include/grub/dl.h +++ b/include/grub/dl.h @@ -1,9 +1,9 @@ /* dl.h - types and prototypes for loadable module support */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,77 +14,77 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_DL_H -#define PUPA_DL_H 1 +#ifndef GRUB_DL_H +#define GRUB_DL_H 1 -#include -#include -#include +#include +#include +#include -#define PUPA_MOD_INIT \ -static void pupa_mod_init (pupa_dl_t mod) __attribute__ ((unused)); \ +#define GRUB_MOD_INIT \ +static void grub_mod_init (grub_dl_t mod) __attribute__ ((unused)); \ static void \ -pupa_mod_init (pupa_dl_t mod) +grub_mod_init (grub_dl_t mod) -#define PUPA_MOD_FINI \ -static void pupa_mod_fini (void) __attribute__ ((unused)); \ +#define GRUB_MOD_FINI \ +static void grub_mod_fini (void) __attribute__ ((unused)); \ static void \ -pupa_mod_fini (void) +grub_mod_fini (void) -#define PUPA_MOD_NAME(name) \ +#define GRUB_MOD_NAME(name) \ __asm__ (".section .modname,\"S\"\n.string \"" #name "\"\n.previous") -#define PUPA_MOD_DEP(name) \ +#define GRUB_MOD_DEP(name) \ __asm__ (".section .moddeps,\"S\"\n.string \"" #name "\"\n.previous") -struct pupa_dl_segment +struct grub_dl_segment { - struct pupa_dl_segment *next; + struct grub_dl_segment *next; void *addr; - pupa_size_t size; + grub_size_t size; unsigned section; }; -typedef struct pupa_dl_segment *pupa_dl_segment_t; +typedef struct grub_dl_segment *grub_dl_segment_t; -struct pupa_dl; +struct grub_dl; -struct pupa_dl_dep +struct grub_dl_dep { - struct pupa_dl_dep *next; - struct pupa_dl *mod; + struct grub_dl_dep *next; + struct grub_dl *mod; }; -typedef struct pupa_dl_dep *pupa_dl_dep_t; +typedef struct grub_dl_dep *grub_dl_dep_t; -struct pupa_dl +struct grub_dl { char *name; int ref_count; - pupa_dl_dep_t dep; - pupa_dl_segment_t segment; - void (*init) (struct pupa_dl *mod); + grub_dl_dep_t dep; + grub_dl_segment_t segment; + void (*init) (struct grub_dl *mod); void (*fini) (void); }; -typedef struct pupa_dl *pupa_dl_t; +typedef struct grub_dl *grub_dl_t; -pupa_dl_t EXPORT_FUNC(pupa_dl_load_file) (const char *filename); -pupa_dl_t EXPORT_FUNC(pupa_dl_load) (const char *name); -pupa_dl_t pupa_dl_load_core (void *addr, pupa_size_t size); -int EXPORT_FUNC(pupa_dl_unload) (pupa_dl_t mod); -void pupa_dl_unload_unneeded (void); -void pupa_dl_unload_all (void); -int EXPORT_FUNC(pupa_dl_ref) (pupa_dl_t mod); -int EXPORT_FUNC(pupa_dl_unref) (pupa_dl_t mod); -void EXPORT_FUNC(pupa_dl_iterate) (int (*hook) (pupa_dl_t mod)); -pupa_dl_t EXPORT_FUNC(pupa_dl_get) (const char *name); -pupa_err_t EXPORT_FUNC(pupa_dl_register_symbol) (const char *name, void *addr, - pupa_dl_t mod); -void *EXPORT_FUNC(pupa_dl_resolve_symbol) (const char *name); +grub_dl_t EXPORT_FUNC(grub_dl_load_file) (const char *filename); +grub_dl_t EXPORT_FUNC(grub_dl_load) (const char *name); +grub_dl_t grub_dl_load_core (void *addr, grub_size_t size); +int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod); +void grub_dl_unload_unneeded (void); +void grub_dl_unload_all (void); +int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod); +int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod); +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 EXPORT_FUNC(grub_dl_register_symbol) (const char *name, void *addr, + grub_dl_t mod); +void *EXPORT_FUNC(grub_dl_resolve_symbol) (const char *name); -int pupa_arch_dl_check_header (void *ehdr, pupa_size_t size); -pupa_err_t pupa_arch_dl_relocate_symbols (pupa_dl_t mod, void *ehdr); +int grub_arch_dl_check_header (void *ehdr, grub_size_t size); +grub_err_t grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr); -#endif /* ! PUPA_DL_H */ +#endif /* ! GRUB_DL_H */ diff --git a/include/grub/elf.h b/include/grub/elf.h index 1ff12c520..91f1f3ccd 100644 --- a/include/grub/elf.h +++ b/include/grub/elf.h @@ -17,40 +17,40 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifndef PUPA_ELF_H -#define PUPA_ELF_H 1 +#ifndef GRUB_ELF_H +#define GRUB_ELF_H 1 /* Standard ELF types. */ -#include +#include /* Type for a 16-bit quantity. */ -typedef pupa_uint16_t Elf32_Half; -typedef pupa_uint16_t Elf64_Half; +typedef grub_uint16_t Elf32_Half; +typedef grub_uint16_t Elf64_Half; /* Types for signed and unsigned 32-bit quantities. */ -typedef pupa_uint32_t Elf32_Word; -typedef pupa_int32_t Elf32_Sword; -typedef pupa_uint32_t Elf64_Word; -typedef pupa_int32_t Elf64_Sword; +typedef grub_uint32_t Elf32_Word; +typedef grub_int32_t Elf32_Sword; +typedef grub_uint32_t Elf64_Word; +typedef grub_int32_t Elf64_Sword; /* Types for signed and unsigned 64-bit quantities. */ -typedef pupa_uint64_t Elf32_Xword; -typedef pupa_int64_t Elf32_Sxword; -typedef pupa_uint64_t Elf64_Xword; -typedef pupa_int64_t Elf64_Sxword; +typedef grub_uint64_t Elf32_Xword; +typedef grub_int64_t Elf32_Sxword; +typedef grub_uint64_t Elf64_Xword; +typedef grub_int64_t Elf64_Sxword; /* Type of addresses. */ -typedef pupa_uint32_t Elf32_Addr; -typedef pupa_uint64_t Elf64_Addr; +typedef grub_uint32_t Elf32_Addr; +typedef grub_uint64_t Elf64_Addr; /* Type of file offsets. */ -typedef pupa_uint32_t Elf32_Off; -typedef pupa_uint64_t Elf64_Off; +typedef grub_uint32_t Elf32_Off; +typedef grub_uint64_t Elf64_Off; /* Type for section indices, which are 16-bit quantities. */ -typedef pupa_uint16_t Elf32_Section; -typedef pupa_uint16_t Elf64_Section; +typedef grub_uint16_t Elf32_Section; +typedef grub_uint16_t Elf64_Section; /* Type for version symbol information. */ typedef Elf32_Half Elf32_Versym; @@ -2310,4 +2310,4 @@ typedef Elf32_Addr Elf32_Conflict; #define R_X86_64_NUM 24 -#endif /* ! PUPA_ELF_H */ +#endif /* ! GRUB_ELF_H */ diff --git a/include/grub/env.h b/include/grub/env.h index 71c087f8c..78e3ac0c6 100644 --- a/include/grub/env.h +++ b/include/grub/env.h @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,37 +13,37 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_ENV_HEADER -#define PUPA_ENV_HEADER 1 +#ifndef GRUB_ENV_HEADER +#define GRUB_ENV_HEADER 1 -#include -#include -#include +#include +#include +#include -struct pupa_env_var +struct grub_env_var { char *name; char *value; - pupa_err_t (*read_hook) (struct pupa_env_var *var, char **val); - pupa_err_t (*write_hook) (struct pupa_env_var *var); - struct pupa_env_var *next; - struct pupa_env_var **prevp; - struct pupa_env_var *sort_next; - struct pupa_env_var **sort_prevp; + grub_err_t (*read_hook) (struct grub_env_var *var, char **val); + grub_err_t (*write_hook) (struct grub_env_var *var); + struct grub_env_var *next; + struct grub_env_var **prevp; + struct grub_env_var *sort_next; + struct grub_env_var **sort_prevp; }; -pupa_err_t EXPORT_FUNC(pupa_env_set) (const char *var, const char *val); -char *EXPORT_FUNC(pupa_env_get) (const char *name); -void EXPORT_FUNC(pupa_env_unset) (const char *name); -void EXPORT_FUNC(pupa_env_iterate) (int (* func) (struct pupa_env_var *var)); -pupa_err_t EXPORT_FUNC(pupa_register_variable_hook) (const char *var, - pupa_err_t (*read_hook) - (struct pupa_env_var *var, char **val), - pupa_err_t (*write_hook) - (struct pupa_env_var *var)); +grub_err_t EXPORT_FUNC(grub_env_set) (const char *var, const char *val); +char *EXPORT_FUNC(grub_env_get) (const char *name); +void EXPORT_FUNC(grub_env_unset) (const char *name); +void EXPORT_FUNC(grub_env_iterate) (int (* func) (struct grub_env_var *var)); +grub_err_t EXPORT_FUNC(grub_register_variable_hook) (const char *var, + grub_err_t (*read_hook) + (struct grub_env_var *var, char **val), + grub_err_t (*write_hook) + (struct grub_env_var *var)); -#endif /* ! PUPA_ENV_HEADER */ +#endif /* ! GRUB_ENV_HEADER */ diff --git a/include/grub/err.h b/include/grub/err.h index 59ab341a1..a630ec8aa 100644 --- a/include/grub/err.h +++ b/include/grub/err.h @@ -1,9 +1,9 @@ /* err.h - error numbers and prototypes */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,49 +14,49 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_ERR_HEADER -#define PUPA_ERR_HEADER 1 +#ifndef GRUB_ERR_HEADER +#define GRUB_ERR_HEADER 1 -#include +#include typedef enum { - PUPA_ERR_NONE = 0, - PUPA_ERR_BAD_MODULE, - PUPA_ERR_OUT_OF_MEMORY, - PUPA_ERR_BAD_FILE_TYPE, - PUPA_ERR_FILE_NOT_FOUND, - PUPA_ERR_FILE_READ_ERROR, - PUPA_ERR_BAD_FILENAME, - PUPA_ERR_UNKNOWN_FS, - PUPA_ERR_BAD_FS, - PUPA_ERR_BAD_NUMBER, - PUPA_ERR_OUT_OF_RANGE, - PUPA_ERR_UNKNOWN_DEVICE, - PUPA_ERR_BAD_DEVICE, - PUPA_ERR_READ_ERROR, - PUPA_ERR_WRITE_ERROR, - PUPA_ERR_UNKNOWN_COMMAND, - PUPA_ERR_BAD_ARGUMENT, - PUPA_ERR_BAD_PART_TABLE, - PUPA_ERR_UNKNOWN_OS, - PUPA_ERR_BAD_OS, - PUPA_ERR_NO_KERNEL, - PUPA_ERR_BAD_FONT, - PUPA_ERR_NOT_IMPLEMENTED_YET, - PUPA_ERR_SYMLINK_LOOP + GRUB_ERR_NONE = 0, + GRUB_ERR_BAD_MODULE, + GRUB_ERR_OUT_OF_MEMORY, + GRUB_ERR_BAD_FILE_TYPE, + GRUB_ERR_FILE_NOT_FOUND, + GRUB_ERR_FILE_READ_ERROR, + GRUB_ERR_BAD_FILENAME, + GRUB_ERR_UNKNOWN_FS, + GRUB_ERR_BAD_FS, + GRUB_ERR_BAD_NUMBER, + GRUB_ERR_OUT_OF_RANGE, + GRUB_ERR_UNKNOWN_DEVICE, + GRUB_ERR_BAD_DEVICE, + GRUB_ERR_READ_ERROR, + GRUB_ERR_WRITE_ERROR, + GRUB_ERR_UNKNOWN_COMMAND, + GRUB_ERR_BAD_ARGUMENT, + GRUB_ERR_BAD_PART_TABLE, + GRUB_ERR_UNKNOWN_OS, + GRUB_ERR_BAD_OS, + GRUB_ERR_NO_KERNEL, + GRUB_ERR_BAD_FONT, + GRUB_ERR_NOT_IMPLEMENTED_YET, + GRUB_ERR_SYMLINK_LOOP } -pupa_err_t; +grub_err_t; -extern pupa_err_t EXPORT_VAR(pupa_errno); -extern char EXPORT_VAR(pupa_errmsg)[]; +extern grub_err_t EXPORT_VAR(grub_errno); +extern char EXPORT_VAR(grub_errmsg)[]; -pupa_err_t EXPORT_FUNC(pupa_error) (pupa_err_t n, const char *fmt, ...); -void EXPORT_FUNC(pupa_fatal) (const char *fmt, ...) __attribute__ ((noreturn)); -void EXPORT_FUNC(pupa_print_error) (void); +grub_err_t EXPORT_FUNC(grub_error) (grub_err_t n, const char *fmt, ...); +void EXPORT_FUNC(grub_fatal) (const char *fmt, ...) __attribute__ ((noreturn)); +void EXPORT_FUNC(grub_print_error) (void); -#endif /* ! PUPA_ERR_HEADER */ +#endif /* ! GRUB_ERR_HEADER */ diff --git a/include/grub/file.h b/include/grub/file.h index 9c876ca4c..d5c85bc4a 100644 --- a/include/grub/file.h +++ b/include/grub/file.h @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,32 +13,32 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_FILE_HEADER -#define PUPA_FILE_HEADER 1 +#ifndef GRUB_FILE_HEADER +#define GRUB_FILE_HEADER 1 -#include -#include -#include -#include +#include +#include +#include +#include /* File description. */ -struct pupa_file +struct grub_file { /* The underlying device. */ - pupa_device_t device; + grub_device_t device; /* The underlying filesystem. */ - pupa_fs_t fs; + grub_fs_t fs; /* The current offset. */ - pupa_ssize_t offset; + grub_ssize_t offset; /* The file size. */ - pupa_ssize_t size; + grub_ssize_t size; /* Filesystem-specific data. */ void *data; @@ -46,28 +46,28 @@ struct pupa_file /* This is called when a sector is read. Used only for a disk device. */ void (*read_hook) (unsigned long sector, unsigned offset, unsigned length); }; -typedef struct pupa_file *pupa_file_t; +typedef struct grub_file *grub_file_t; /* Get a device name from NAME. */ -char *EXPORT_FUNC(pupa_file_get_device_name) (const char *name); +char *EXPORT_FUNC(grub_file_get_device_name) (const char *name); -pupa_file_t EXPORT_FUNC(pupa_file_open) (const char *name); -pupa_ssize_t EXPORT_FUNC(pupa_file_read) (pupa_file_t file, char *buf, - pupa_ssize_t len); -pupa_ssize_t EXPORT_FUNC(pupa_file_seek) (pupa_file_t file, - pupa_ssize_t offset); -pupa_err_t EXPORT_FUNC(pupa_file_close) (pupa_file_t file); +grub_file_t EXPORT_FUNC(grub_file_open) (const char *name); +grub_ssize_t EXPORT_FUNC(grub_file_read) (grub_file_t file, char *buf, + grub_ssize_t len); +grub_ssize_t EXPORT_FUNC(grub_file_seek) (grub_file_t file, + grub_ssize_t offset); +grub_err_t EXPORT_FUNC(grub_file_close) (grub_file_t file); -static inline pupa_ssize_t -pupa_file_size (const pupa_file_t file) +static inline grub_ssize_t +grub_file_size (const grub_file_t file) { return file->size; } -static inline pupa_ssize_t -pupa_file_tell (const pupa_file_t file) +static inline grub_ssize_t +grub_file_tell (const grub_file_t file) { return file->offset; } -#endif /* ! PUPA_FILE_HEADER */ +#endif /* ! GRUB_FILE_HEADER */ diff --git a/include/grub/font.h b/include/grub/font.h index 57719c7ef..e499f81eb 100644 --- a/include/grub/font.h +++ b/include/grub/font.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,14 +17,14 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_FONT_HEADER -#define PUPA_FONT_HEADER 1 +#ifndef GRUB_FONT_HEADER +#define GRUB_FONT_HEADER 1 -#include +#include -#define PUPA_FONT_MAGIC "PPF\x7f" +#define GRUB_FONT_MAGIC "PPF\x7f" -int pupa_font_get_glyph (pupa_uint32_t code, +int grub_font_get_glyph (grub_uint32_t code, unsigned char bitmap[32], unsigned *width); -#endif /* ! PUPA_FONT_HEADER */ +#endif /* ! GRUB_FONT_HEADER */ diff --git a/include/grub/fs.h b/include/grub/fs.h index b4ceed643..2af59e29d 100644 --- a/include/grub/fs.h +++ b/include/grub/fs.h @@ -1,9 +1,9 @@ /* fs.h - filesystem manager */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,62 +14,62 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_FS_HEADER -#define PUPA_FS_HEADER 1 +#ifndef GRUB_FS_HEADER +#define GRUB_FS_HEADER 1 -#include -#include -#include +#include +#include +#include /* Forward declaration is required, because of mutual reference. */ -struct pupa_file; +struct grub_file; /* Filesystem descriptor. */ -struct pupa_fs +struct grub_fs { /* My name. */ const char *name; /* Call HOOK with each file under DIR. */ - pupa_err_t (*dir) (pupa_device_t device, const char *path, + grub_err_t (*dir) (grub_device_t device, const char *path, int (*hook) (const char *filename, int dir)); /* Open a file named NAME and initialize FILE. */ - pupa_err_t (*open) (struct pupa_file *file, const char *name); + grub_err_t (*open) (struct grub_file *file, const char *name); /* Read LEN bytes data from FILE into BUF. */ - pupa_ssize_t (*read) (struct pupa_file *file, char *buf, pupa_ssize_t len); + grub_ssize_t (*read) (struct grub_file *file, char *buf, grub_ssize_t len); /* Close the file FILE. */ - pupa_err_t (*close) (struct pupa_file *file); + grub_err_t (*close) (struct grub_file *file); /* Return the label of the device DEVICE in LABEL. The label is - returned in a pupa_malloc'ed buffer and should be freed by the + returned in a grub_malloc'ed buffer and should be freed by the caller. */ - pupa_err_t (*label) (pupa_device_t device, char **label); + grub_err_t (*label) (grub_device_t device, char **label); /* The next filesystem. */ - struct pupa_fs *next; + struct grub_fs *next; }; -typedef struct pupa_fs *pupa_fs_t; +typedef struct grub_fs *grub_fs_t; /* This is special, because block lists are not files in usual sense. */ -extern struct pupa_fs pupa_fs_blocklist; +extern struct grub_fs grub_fs_blocklist; -void EXPORT_FUNC(pupa_fs_register) (pupa_fs_t fs); -void EXPORT_FUNC(pupa_fs_unregister) (pupa_fs_t fs); -void EXPORT_FUNC(pupa_fs_iterate) (int (*hook) (const pupa_fs_t fs)); -pupa_fs_t EXPORT_FUNC(pupa_fs_probe) (pupa_device_t device); +void EXPORT_FUNC(grub_fs_register) (grub_fs_t fs); +void EXPORT_FUNC(grub_fs_unregister) (grub_fs_t fs); +void EXPORT_FUNC(grub_fs_iterate) (int (*hook) (const grub_fs_t fs)); +grub_fs_t EXPORT_FUNC(grub_fs_probe) (grub_device_t device); -#ifdef PUPA_UTIL -void pupa_fat_init (void); -void pupa_fat_fini (void); -void pupa_ext2_init (void); -void pupa_ext2_fini (void); -#endif /* PUPA_UTIL */ +#ifdef GRUB_UTIL +void grub_fat_init (void); +void grub_fat_fini (void); +void grub_ext2_init (void); +void grub_ext2_fini (void); +#endif /* GRUB_UTIL */ -#endif /* ! PUPA_FS_HEADER */ +#endif /* ! GRUB_FS_HEADER */ diff --git a/include/grub/i386/pc/biosdisk.h b/include/grub/i386/pc/biosdisk.h index ba7238e0d..760e0734c 100644 --- a/include/grub/i386/pc/biosdisk.h +++ b/include/grub/i386/pc/biosdisk.h @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,16 +13,16 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_BIOSDISK_MACHINE_HEADER -#define PUPA_BIOSDISK_MACHINE_HEADER 1 +#ifndef GRUB_BIOSDISK_MACHINE_HEADER +#define GRUB_BIOSDISK_MACHINE_HEADER 1 -#define PUPA_BIOSDISK_FLAG_LBA 1 +#define GRUB_BIOSDISK_FLAG_LBA 1 -struct pupa_biosdisk_data +struct grub_biosdisk_data { int drive; unsigned long cylinders; @@ -31,17 +31,17 @@ struct pupa_biosdisk_data unsigned long flags; }; -int pupa_biosdisk_rw_int13_extensions (int ah, int drive, void *dap); -int pupa_biosdisk_rw_standard (int ah, int drive, int coff, int hoff, +int grub_biosdisk_rw_int13_extensions (int ah, int drive, void *dap); +int grub_biosdisk_rw_standard (int ah, int drive, int coff, int hoff, int soff, int nsec, int segment); -int pupa_biosdisk_check_int13_extensions (int drive); -int pupa_biosdisk_get_diskinfo_int13_extensions (int drive, void *drp); -int pupa_biosdisk_get_diskinfo_standard (int drive, +int grub_biosdisk_check_int13_extensions (int drive); +int grub_biosdisk_get_diskinfo_int13_extensions (int drive, void *drp); +int grub_biosdisk_get_diskinfo_standard (int drive, unsigned long *cylinders, unsigned long *heads, unsigned long *sectors); -int pupa_biosdisk_get_num_floppies (void); +int grub_biosdisk_get_num_floppies (void); -void pupa_biosdisk_init (void); +void grub_biosdisk_init (void); -#endif /* ! PUPA_BIOSDISK_MACHINE_HEADER */ +#endif /* ! GRUB_BIOSDISK_MACHINE_HEADER */ diff --git a/include/grub/i386/pc/boot.h b/include/grub/i386/pc/boot.h index 90a58ec25..a9e9e9800 100644 --- a/include/grub/i386/pc/boot.h +++ b/include/grub/i386/pc/boot.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 1999,2000,2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,69 +17,69 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_BOOT_MACHINE_HEADER -#define PUPA_BOOT_MACHINE_HEADER 1 +#ifndef GRUB_BOOT_MACHINE_HEADER +#define GRUB_BOOT_MACHINE_HEADER 1 /* The signature for bootloader. */ -#define PUPA_BOOT_MACHINE_SIGNATURE 0xaa55 +#define GRUB_BOOT_MACHINE_SIGNATURE 0xaa55 /* The offset of the start of BPB (BIOS Parameter Block). */ -#define PUPA_BOOT_MACHINE_BPB_START 0x3 +#define GRUB_BOOT_MACHINE_BPB_START 0x3 /* The offset of the end of BPB (BIOS Parameter Block). */ -#define PUPA_BOOT_MACHINE_BPB_END 0x3e +#define GRUB_BOOT_MACHINE_BPB_END 0x3e /* The offset of the major version. */ -#define PUPA_BOOT_MACHINE_VER_MAJ 0x3e +#define GRUB_BOOT_MACHINE_VER_MAJ 0x3e /* The offset of BOOT_DRIVE. */ -#define PUPA_BOOT_MACHINE_BOOT_DRIVE 0x40 +#define GRUB_BOOT_MACHINE_BOOT_DRIVE 0x40 /* The offset of FORCE_LBA. */ -#define PUPA_BOOT_MACHINE_FORCE_LBA 0x41 +#define GRUB_BOOT_MACHINE_FORCE_LBA 0x41 /* The offset of KERNEL_ADDRESS. */ -#define PUPA_BOOT_MACHINE_KERNEL_ADDRESS 0x42 +#define GRUB_BOOT_MACHINE_KERNEL_ADDRESS 0x42 /* The offset of KERNEL_SECTOR. */ -#define PUPA_BOOT_MACHINE_KERNEL_SECTOR 0x44 +#define GRUB_BOOT_MACHINE_KERNEL_SECTOR 0x44 /* The offset of KERNEL_SEGMENT. */ -#define PUPA_BOOT_MACHINE_KERNEL_SEGMENT 0x48 +#define GRUB_BOOT_MACHINE_KERNEL_SEGMENT 0x48 /* The offset of a magic number used by Windows NT. */ -#define PUPA_BOOT_MACHINE_WINDOWS_NT_MAGIC 0x1b8 +#define GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC 0x1b8 /* The offset of the start of the partition table. */ -#define PUPA_BOOT_MACHINE_PART_START 0x1be +#define GRUB_BOOT_MACHINE_PART_START 0x1be /* The offset of the end of the partition table. */ -#define PUPA_BOOT_MACHINE_PART_END 0x1fe +#define GRUB_BOOT_MACHINE_PART_END 0x1fe /* The stack segment. */ -#define PUPA_BOOT_MACHINE_STACK_SEG 0x2000 +#define GRUB_BOOT_MACHINE_STACK_SEG 0x2000 /* The segment of disk buffer. The disk buffer MUST be 32K long and cannot straddle a 64K boundary. */ -#define PUPA_BOOT_MACHINE_BUFFER_SEG 0x7000 +#define GRUB_BOOT_MACHINE_BUFFER_SEG 0x7000 /* The address of drive parameters. */ -#define PUPA_BOOT_MACHINE_DRP_ADDR 0x7f00 +#define GRUB_BOOT_MACHINE_DRP_ADDR 0x7f00 /* The size of drive parameters. */ -#define PUPA_BOOT_MACHINE_DRP_SIZE 0x42 +#define GRUB_BOOT_MACHINE_DRP_SIZE 0x42 /* The flag for BIOS drive number to designate a hard disk vs. a floppy. */ -#define PUPA_BOOT_MACHINE_BIOS_HD_FLAG 0x80 +#define GRUB_BOOT_MACHINE_BIOS_HD_FLAG 0x80 /* The segment where the kernel is loaded. */ -#define PUPA_BOOT_MACHINE_KERNEL_SEG 0x800 +#define GRUB_BOOT_MACHINE_KERNEL_SEG 0x800 /* The address where the kernel is loaded. */ -#define PUPA_BOOT_MACHINE_KERNEL_ADDR (PUPA_BOOT_MACHINE_KERNEL_SEG << 4) +#define GRUB_BOOT_MACHINE_KERNEL_ADDR (GRUB_BOOT_MACHINE_KERNEL_SEG << 4) /* The size of a block list used in the kernel startup code. */ -#define PUPA_BOOT_MACHINE_LIST_SIZE 8 +#define GRUB_BOOT_MACHINE_LIST_SIZE 8 #endif /* ! BOOT_MACHINE_HEADER */ diff --git a/include/grub/i386/pc/console.h b/include/grub/i386/pc/console.h index 58f3200f6..e8a89fe0c 100644 --- a/include/grub/i386/pc/console.h +++ b/include/grub/i386/pc/console.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,40 +17,40 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_CONSOLE_MACHINE_HEADER -#define PUPA_CONSOLE_MACHINE_HEADER 1 +#ifndef GRUB_CONSOLE_MACHINE_HEADER +#define GRUB_CONSOLE_MACHINE_HEADER 1 /* Define scan codes. */ -#define PUPA_CONSOLE_KEY_LEFT 0x4B00 -#define PUPA_CONSOLE_KEY_RIGHT 0x4D00 -#define PUPA_CONSOLE_KEY_UP 0x4800 -#define PUPA_CONSOLE_KEY_DOWN 0x5000 -#define PUPA_CONSOLE_KEY_IC 0x5200 -#define PUPA_CONSOLE_KEY_DC 0x5300 -#define PUPA_CONSOLE_KEY_BACKSPACE 0x0008 -#define PUPA_CONSOLE_KEY_HOME 0x4700 -#define PUPA_CONSOLE_KEY_END 0x4F00 -#define PUPA_CONSOLE_KEY_NPAGE 0x4900 -#define PUPA_CONSOLE_KEY_PPAGE 0x5100 +#define GRUB_CONSOLE_KEY_LEFT 0x4B00 +#define GRUB_CONSOLE_KEY_RIGHT 0x4D00 +#define GRUB_CONSOLE_KEY_UP 0x4800 +#define GRUB_CONSOLE_KEY_DOWN 0x5000 +#define GRUB_CONSOLE_KEY_IC 0x5200 +#define GRUB_CONSOLE_KEY_DC 0x5300 +#define GRUB_CONSOLE_KEY_BACKSPACE 0x0008 +#define GRUB_CONSOLE_KEY_HOME 0x4700 +#define GRUB_CONSOLE_KEY_END 0x4F00 +#define GRUB_CONSOLE_KEY_NPAGE 0x4900 +#define GRUB_CONSOLE_KEY_PPAGE 0x5100 #ifndef ASM_FILE -#include -#include +#include +#include /* These are global to share code between C and asm. */ -extern pupa_uint8_t pupa_console_cur_color; -void pupa_console_real_putchar (int c); -int EXPORT_FUNC(pupa_console_checkkey) (void); -int EXPORT_FUNC(pupa_console_getkey) (void); -pupa_uint16_t pupa_console_getxy (void); -void pupa_console_gotoxy (pupa_uint8_t x, pupa_uint8_t y); -void pupa_console_cls (void); -void pupa_console_setcursor (int on); +extern grub_uint8_t grub_console_cur_color; +void grub_console_real_putchar (int c); +int EXPORT_FUNC(grub_console_checkkey) (void); +int EXPORT_FUNC(grub_console_getkey) (void); +grub_uint16_t grub_console_getxy (void); +void grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y); +void grub_console_cls (void); +void grub_console_setcursor (int on); /* Initialize the console system. */ -void pupa_console_init (void); +void grub_console_init (void); #endif -#endif /* ! PUPA_CONSOLE_MACHINE_HEADER */ +#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */ diff --git a/include/grub/i386/pc/init.h b/include/grub/i386/pc/init.h index 703af536e..134173f8b 100644 --- a/include/grub/i386/pc/init.h +++ b/include/grub/i386/pc/init.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,38 +17,38 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_INIT_MACHINE_HEADER -#define PUPA_INIT_MACHINE_HEADER 1 +#ifndef GRUB_INIT_MACHINE_HEADER +#define GRUB_INIT_MACHINE_HEADER 1 -#include -#include +#include +#include /* FIXME: Should these be declared in memory.h? */ -extern pupa_size_t EXPORT_VAR(pupa_lower_mem); -extern pupa_size_t EXPORT_VAR(pupa_upper_mem); +extern grub_size_t EXPORT_VAR(grub_lower_mem); +extern grub_size_t EXPORT_VAR(grub_upper_mem); /* Get the memory size in KB. If EXTENDED is zero, return conventional memory, otherwise return extended memory. */ -pupa_uint16_t pupa_get_memsize (int extended); +grub_uint16_t grub_get_memsize (int extended); /* Get a packed EISA memory map. Lower 16 bits are between 1MB and 16MB in 1KB parts, and upper 16 bits are above 16MB in 64KB parts. */ -pupa_uint32_t pupa_get_eisa_mmap (void); +grub_uint32_t grub_get_eisa_mmap (void); -struct pupa_machine_mmap_entry +struct grub_machine_mmap_entry { - pupa_uint32_t size; - pupa_uint64_t addr; - pupa_uint64_t len; - pupa_uint32_t type; + grub_uint32_t size; + grub_uint64_t addr; + grub_uint64_t len; + grub_uint32_t type; }; /* Get a memory map entry. Return next continuation value. Zero means the end. */ -pupa_uint32_t pupa_get_mmap_entry (struct pupa_machine_mmap_entry *entry, - pupa_uint32_t cont); +grub_uint32_t grub_get_mmap_entry (struct grub_machine_mmap_entry *entry, + grub_uint32_t cont); /* Turn on/off Gate A20. */ -void pupa_gate_a20 (int on); +void grub_gate_a20 (int on); -#endif /* ! PUPA_INIT_MACHINE_HEADER */ +#endif /* ! GRUB_INIT_MACHINE_HEADER */ diff --git a/include/grub/i386/pc/kernel.h b/include/grub/i386/pc/kernel.h index a090e0038..e5e30cdb3 100644 --- a/include/grub/i386/pc/kernel.h +++ b/include/grub/i386/pc/kernel.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -20,43 +20,43 @@ #ifndef KERNEL_MACHINE_HEADER #define KERNEL_MACHINE_HEADER 1 -/* The offset of PUPA_TOTAL_MODULE_SIZE. */ -#define PUPA_KERNEL_MACHINE_TOTAL_MODULE_SIZE 0x8 +/* The offset of GRUB_TOTAL_MODULE_SIZE. */ +#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE 0x8 -/* The offset of PUPA_KERNEL_IMAGE_SIZE. */ -#define PUPA_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc +/* The offset of GRUB_KERNEL_IMAGE_SIZE. */ +#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc -/* The offset of PUPA_COMPRESSED_SIZE. */ -#define PUPA_KERNEL_MACHINE_COMPRESSED_SIZE 0x10 +/* The offset of GRUB_COMPRESSED_SIZE. */ +#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE 0x10 -/* The offset of PUPA_INSTALL_DOS_PART. */ -#define PUPA_KERNEL_MACHINE_INSTALL_DOS_PART 0x14 +/* The offset of GRUB_INSTALL_DOS_PART. */ +#define GRUB_KERNEL_MACHINE_INSTALL_DOS_PART 0x14 -/* The offset of PUPA_INSTALL_BSD_PART. */ -#define PUPA_KERNEL_MACHINE_INSTALL_BSD_PART 0x18 +/* The offset of GRUB_INSTALL_BSD_PART. */ +#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART 0x18 -/* The offset of PUPA_PREFIX. */ -#define PUPA_KERNEL_MACHINE_PREFIX 0x1c +/* The offset of GRUB_PREFIX. */ +#define GRUB_KERNEL_MACHINE_PREFIX 0x1c /* The size of the first region which won't be compressed. */ -#define PUPA_KERNEL_MACHINE_RAW_SIZE 0x400 +#define GRUB_KERNEL_MACHINE_RAW_SIZE 0x400 #ifndef ASM_FILE -#include +#include /* The DOS partition number of the installed partition. */ -extern pupa_int32_t pupa_install_dos_part; +extern grub_int32_t grub_install_dos_part; /* The BSD partition number of the installed partition. */ -extern pupa_int32_t pupa_install_bsd_part; +extern grub_int32_t grub_install_bsd_part; -/* The prefix which points to the directory where PUPA modules and its +/* The prefix which points to the directory where GRUB modules and its configuration file are located. */ -extern char pupa_prefix[]; +extern char grub_prefix[]; /* The boot BIOS drive number. */ -extern pupa_int32_t pupa_boot_drive; +extern grub_int32_t grub_boot_drive; #endif /* ! ASM_FILE */ diff --git a/include/grub/i386/pc/linux.h b/include/grub/i386/pc/linux.h index c1c028652..c2b733ec7 100644 --- a/include/grub/i386/pc/linux.h +++ b/include/grub/i386/pc/linux.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,70 +17,70 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_LINUX_MACHINE_HEADER -#define PUPA_LINUX_MACHINE_HEADER 1 +#ifndef GRUB_LINUX_MACHINE_HEADER +#define GRUB_LINUX_MACHINE_HEADER 1 -#define PUPA_LINUX_MAGIC_SIGNATURE 0x53726448 /* "HdrS" */ -#define PUPA_LINUX_DEFAULT_SETUP_SECTS 4 -#define PUPA_LINUX_FLAG_CAN_USE_HEAP 0x80 -#define PUPA_LINUX_INITRD_MAX_ADDRESS 0x37FFFFFF -#define PUPA_LINUX_MAX_SETUP_SECTS 64 -#define PUPA_LINUX_BOOT_LOADER_TYPE 0x72 -#define PUPA_LINUX_HEAP_END_OFFSET (0x9000 - 0x200) +#define GRUB_LINUX_MAGIC_SIGNATURE 0x53726448 /* "HdrS" */ +#define GRUB_LINUX_DEFAULT_SETUP_SECTS 4 +#define GRUB_LINUX_FLAG_CAN_USE_HEAP 0x80 +#define GRUB_LINUX_INITRD_MAX_ADDRESS 0x37FFFFFF +#define GRUB_LINUX_MAX_SETUP_SECTS 64 +#define GRUB_LINUX_BOOT_LOADER_TYPE 0x72 +#define GRUB_LINUX_HEAP_END_OFFSET (0x9000 - 0x200) -#define PUPA_LINUX_BZIMAGE_ADDR 0x100000 -#define PUPA_LINUX_ZIMAGE_ADDR 0x10000 -#define PUPA_LINUX_OLD_REAL_MODE_ADDR 0x90000 -#define PUPA_LINUX_SETUP_STACK 0x9000 +#define GRUB_LINUX_BZIMAGE_ADDR 0x100000 +#define GRUB_LINUX_ZIMAGE_ADDR 0x10000 +#define GRUB_LINUX_OLD_REAL_MODE_ADDR 0x90000 +#define GRUB_LINUX_SETUP_STACK 0x9000 -#define PUPA_LINUX_FLAG_BIG_KERNEL 0x1 +#define GRUB_LINUX_FLAG_BIG_KERNEL 0x1 /* Linux's video mode selection support. Actually I hate it! */ -#define PUPA_LINUX_VID_MODE_NORMAL 0xFFFF -#define PUPA_LINUX_VID_MODE_EXTENDED 0xFFFE -#define PUPA_LINUX_VID_MODE_ASK 0xFFFD +#define GRUB_LINUX_VID_MODE_NORMAL 0xFFFF +#define GRUB_LINUX_VID_MODE_EXTENDED 0xFFFE +#define GRUB_LINUX_VID_MODE_ASK 0xFFFD -#define PUPA_LINUX_CL_OFFSET 0x9000 -#define PUPA_LINUX_CL_END_OFFSET 0x90FF -#define PUPA_LINUX_SETUP_MOVE_SIZE 0x9100 -#define PUPA_LINUX_CL_MAGIC 0xA33F +#define GRUB_LINUX_CL_OFFSET 0x9000 +#define GRUB_LINUX_CL_END_OFFSET 0x90FF +#define GRUB_LINUX_SETUP_MOVE_SIZE 0x9100 +#define GRUB_LINUX_CL_MAGIC 0xA33F #ifndef ASM_FILE /* For the Linux/i386 boot protocol version 2.03. */ struct linux_kernel_header { - pupa_uint8_t code1[0x0020]; - pupa_uint16_t cl_magic; /* Magic number 0xA33F */ - pupa_uint16_t cl_offset; /* The offset of command line */ - pupa_uint8_t code2[0x01F1 - 0x0020 - 2 - 2]; - pupa_uint8_t setup_sects; /* The size of the setup in sectors */ - pupa_uint16_t root_flags; /* If the root is mounted readonly */ - pupa_uint16_t syssize; /* obsolete */ - pupa_uint16_t swap_dev; /* obsolete */ - pupa_uint16_t ram_size; /* obsolete */ - pupa_uint16_t vid_mode; /* Video mode control */ - pupa_uint16_t root_dev; /* Default root device number */ - pupa_uint16_t boot_flag; /* 0xAA55 magic number */ - pupa_uint16_t jump; /* Jump instruction */ - pupa_uint32_t header; /* Magic signature "HdrS" */ - pupa_uint16_t version; /* Boot protocol version supported */ - pupa_uint32_t realmode_swtch; /* Boot loader hook */ - pupa_uint16_t start_sys; /* The load-low segment (obsolete) */ - pupa_uint16_t kernel_version; /* Points to kernel version string */ - pupa_uint8_t type_of_loader; /* Boot loader identifier */ - pupa_uint8_t loadflags; /* Boot protocol option flags */ - pupa_uint16_t setup_move_size; /* Move to high memory size */ - pupa_uint32_t code32_start; /* Boot loader hook */ - pupa_uint32_t ramdisk_image; /* initrd load address */ - pupa_uint32_t ramdisk_size; /* initrd size */ - pupa_uint32_t bootsect_kludge; /* obsolete */ - pupa_uint16_t heap_end_ptr; /* Free memory after setup end */ - pupa_uint16_t pad1; /* Unused */ + grub_uint8_t code1[0x0020]; + grub_uint16_t cl_magic; /* Magic number 0xA33F */ + grub_uint16_t cl_offset; /* The offset of command line */ + grub_uint8_t code2[0x01F1 - 0x0020 - 2 - 2]; + grub_uint8_t setup_sects; /* The size of the setup in sectors */ + grub_uint16_t root_flags; /* If the root is mounted readonly */ + grub_uint16_t syssize; /* obsolete */ + grub_uint16_t swap_dev; /* obsolete */ + grub_uint16_t ram_size; /* obsolete */ + grub_uint16_t vid_mode; /* Video mode control */ + grub_uint16_t root_dev; /* Default root device number */ + grub_uint16_t boot_flag; /* 0xAA55 magic number */ + grub_uint16_t jump; /* Jump instruction */ + grub_uint32_t header; /* Magic signature "HdrS" */ + grub_uint16_t version; /* Boot protocol version supported */ + grub_uint32_t realmode_swtch; /* Boot loader hook */ + grub_uint16_t start_sys; /* The load-low segment (obsolete) */ + grub_uint16_t kernel_version; /* Points to kernel version string */ + grub_uint8_t type_of_loader; /* Boot loader identifier */ + grub_uint8_t loadflags; /* Boot protocol option flags */ + grub_uint16_t setup_move_size; /* Move to high memory size */ + grub_uint32_t code32_start; /* Boot loader hook */ + grub_uint32_t ramdisk_image; /* initrd load address */ + grub_uint32_t ramdisk_size; /* initrd size */ + grub_uint32_t bootsect_kludge; /* obsolete */ + grub_uint16_t heap_end_ptr; /* Free memory after setup end */ + grub_uint16_t pad1; /* Unused */ char *cmd_line_ptr; /* Points to the kernel command line */ - pupa_uint32_t initrd_addr_max; /* Highest address for initrd */ + grub_uint32_t initrd_addr_max; /* Highest address for initrd */ } __attribute__ ((packed)); #endif /* ! ASM_FILE */ -#endif /* ! PUPA_LINUX_MACHINE_HEADER */ +#endif /* ! GRUB_LINUX_MACHINE_HEADER */ diff --git a/include/grub/i386/pc/loader.h b/include/grub/i386/pc/loader.h index c797f56ba..de0a0b233 100644 --- a/include/grub/i386/pc/loader.h +++ b/include/grub/i386/pc/loader.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,34 +17,34 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_LOADER_MACHINE_HEADER -#define PUPA_LOADER_MACHINE_HEADER 1 +#ifndef GRUB_LOADER_MACHINE_HEADER +#define GRUB_LOADER_MACHINE_HEADER 1 -#include -#include -#include +#include +#include +#include -extern pupa_uint32_t EXPORT_VAR(pupa_linux_prot_size); -extern char *EXPORT_VAR(pupa_linux_tmp_addr); -extern char *EXPORT_VAR(pupa_linux_real_addr); +extern grub_uint32_t EXPORT_VAR(grub_linux_prot_size); +extern char *EXPORT_VAR(grub_linux_tmp_addr); +extern char *EXPORT_VAR(grub_linux_real_addr); -void EXPORT_FUNC(pupa_linux_boot_zimage) (void) __attribute__ ((noreturn)); -void EXPORT_FUNC(pupa_linux_boot_bzimage) (void) __attribute__ ((noreturn)); +void EXPORT_FUNC(grub_linux_boot_zimage) (void) __attribute__ ((noreturn)); +void EXPORT_FUNC(grub_linux_boot_bzimage) (void) __attribute__ ((noreturn)); /* This is an asm part of the chainloader. */ -void EXPORT_FUNC(pupa_chainloader_real_boot) (int drive, void *part_addr) __attribute__ ((noreturn)); +void EXPORT_FUNC(grub_chainloader_real_boot) (int drive, void *part_addr) __attribute__ ((noreturn)); /* The asm part of the multiboot loader. */ -void EXPORT_FUNC(pupa_multiboot_real_boot) (pupa_addr_t entry, - struct pupa_multiboot_info *mbi) +void EXPORT_FUNC(grub_multiboot_real_boot) (grub_addr_t entry, + struct grub_multiboot_info *mbi) __attribute__ ((noreturn)); /* It is necessary to export these functions, because normal mode commands reuse rescue mode commands. */ -void pupa_rescue_cmd_chainloader (int argc, char *argv[]); -void pupa_rescue_cmd_linux (int argc, char *argv[]); -void pupa_rescue_cmd_initrd (int argc, char *argv[]); -void pupa_rescue_cmd_multiboot (int argc, char *argv[]); -void pupa_rescue_cmd_module (int argc, char *argv[]); +void grub_rescue_cmd_chainloader (int argc, char *argv[]); +void grub_rescue_cmd_linux (int argc, char *argv[]); +void grub_rescue_cmd_initrd (int argc, char *argv[]); +void grub_rescue_cmd_multiboot (int argc, char *argv[]); +void grub_rescue_cmd_module (int argc, char *argv[]); -#endif /* ! PUPA_LOADER_MACHINE_HEADER */ +#endif /* ! GRUB_LOADER_MACHINE_HEADER */ diff --git a/include/grub/i386/pc/memory.h b/include/grub/i386/pc/memory.h index a6ae77bc6..f832ad8d0 100644 --- a/include/grub/i386/pc/memory.h +++ b/include/grub/i386/pc/memory.h @@ -1,6 +1,6 @@ /* memory.h - describe the memory map */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,50 +18,50 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_MEMORY_MACHINE_HEADER -#define PUPA_MEMORY_MACHINE_HEADER 1 +#ifndef GRUB_MEMORY_MACHINE_HEADER +#define GRUB_MEMORY_MACHINE_HEADER 1 /* The scratch buffer used in real mode code. */ -#define PUPA_MEMORY_MACHINE_SCRATCH_ADDR 0x68000 -#define PUPA_MEMORY_MACHINE_SCRATCH_SEG (PUPA_MEMORY_MACHINE_SCRATCH_ADDR >> 4) -#define PUPA_MEMORY_MACHINE_SCRATCH_SIZE 0x10000 +#define GRUB_MEMORY_MACHINE_SCRATCH_ADDR 0x68000 +#define GRUB_MEMORY_MACHINE_SCRATCH_SEG (GRUB_MEMORY_MACHINE_SCRATCH_ADDR >> 4) +#define GRUB_MEMORY_MACHINE_SCRATCH_SIZE 0x10000 /* The real mode stack. */ -#define PUPA_MEMORY_MACHINE_REAL_STACK (0x2000 - 0x10) +#define GRUB_MEMORY_MACHINE_REAL_STACK (0x2000 - 0x10) /* The size of the protect mode stack. */ -#define PUPA_MEMORY_MACHINE_PROT_STACK_SIZE 0x8000 +#define GRUB_MEMORY_MACHINE_PROT_STACK_SIZE 0x8000 /* The protected mode stack. */ -#define PUPA_MEMORY_MACHINE_PROT_STACK \ - (PUPA_MEMORY_MACHINE_SCRATCH_ADDR + PUPA_MEMORY_MACHINE_SCRATCH_SIZE \ - + PUPA_MEMORY_MACHINE_PROT_STACK_SIZE - 0x10) +#define GRUB_MEMORY_MACHINE_PROT_STACK \ + (GRUB_MEMORY_MACHINE_SCRATCH_ADDR + GRUB_MEMORY_MACHINE_SCRATCH_SIZE \ + + GRUB_MEMORY_MACHINE_PROT_STACK_SIZE - 0x10) -/* The memory area where PUPA uses its own purpose. */ -#define PUPA_MEMORY_MACHINE_RESERVED_START \ - PUPA_MEMORY_MACHINE_SCRATCH_ADDR -#define PUPA_MEMORY_MACHINE_RESERVED_END \ - (PUPA_MEMORY_MACHINE_PROT_STACK + 0x10) +/* The memory area where GRUB uses its own purpose. */ +#define GRUB_MEMORY_MACHINE_RESERVED_START \ + GRUB_MEMORY_MACHINE_SCRATCH_ADDR +#define GRUB_MEMORY_MACHINE_RESERVED_END \ + (GRUB_MEMORY_MACHINE_PROT_STACK + 0x10) /* The address of a partition table passed to another boot loader. */ -#define PUPA_MEMORY_MACHINE_PART_TABLE_ADDR 0x7be +#define GRUB_MEMORY_MACHINE_PART_TABLE_ADDR 0x7be /* The address where another boot loader is loaded. */ -#define PUPA_MEMORY_MACHINE_BOOT_LOADER_ADDR 0x7c00 +#define GRUB_MEMORY_MACHINE_BOOT_LOADER_ADDR 0x7c00 /* The flag for protected mode. */ -#define PUPA_MEMORY_MACHINE_CR0_PE_ON 0x1 +#define GRUB_MEMORY_MACHINE_CR0_PE_ON 0x1 /* The code segment of the protected mode. */ -#define PUPA_MEMORY_MACHINE_PROT_MODE_CSEG 0x8 +#define GRUB_MEMORY_MACHINE_PROT_MODE_CSEG 0x8 /* The data segment of the protected mode. */ -#define PUPA_MEMORY_MACHINE_PROT_MODE_DSEG 0x10 +#define GRUB_MEMORY_MACHINE_PROT_MODE_DSEG 0x10 /* The code segment of the pseudo real mode. */ -#define PUPA_MEMORY_MACHINE_PSEUDO_REAL_CSEG 0x18 +#define GRUB_MEMORY_MACHINE_PSEUDO_REAL_CSEG 0x18 /* The data segment of the pseudo real mode. */ -#define PUPA_MEMORY_MACHINE_PSEUDO_REAL_DSEG 0x20 +#define GRUB_MEMORY_MACHINE_PSEUDO_REAL_DSEG 0x20 -#endif /* ! PUPA_MEMORY_MACHINE_HEADER */ +#endif /* ! GRUB_MEMORY_MACHINE_HEADER */ diff --git a/include/grub/i386/pc/multiboot.h b/include/grub/i386/pc/multiboot.h index 1ee2759ac..dea3b708b 100644 --- a/include/grub/i386/pc/multiboot.h +++ b/include/grub/i386/pc/multiboot.h @@ -1,6 +1,6 @@ /* multiboot.h - multiboot header file. */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,167 +18,167 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_MULTIBOOT_MACHINE_HEADER -#define PUPA_MULTIBOOT_MACHINE_HEADER 1 +#ifndef GRUB_MULTIBOOT_MACHINE_HEADER +#define GRUB_MULTIBOOT_MACHINE_HEADER 1 /* How many bytes from the start of the file we search for the header. */ -#define PUPA_MB_SEARCH 8192 +#define GRUB_MB_SEARCH 8192 /* The magic field should contain this. */ -#define PUPA_MB_MAGIC 0x1BADB002 +#define GRUB_MB_MAGIC 0x1BADB002 /* This should be in %eax. */ -#define PUPA_MB_MAGIC2 0x2BADB002 +#define GRUB_MB_MAGIC2 0x2BADB002 /* The bits in the required part of flags field we don't support. */ -#define PUPA_MB_UNSUPPORTED 0x0000fffc +#define GRUB_MB_UNSUPPORTED 0x0000fffc /* Alignment of multiboot modules. */ -#define PUPA_MB_MOD_ALIGN 0x00001000 +#define GRUB_MB_MOD_ALIGN 0x00001000 /* * Flags set in the 'flags' member of the multiboot header. */ /* Align all boot modules on i386 page (4KB) boundaries. */ -#define PUPA_MB_PAGE_ALIGN 0x00000001 +#define GRUB_MB_PAGE_ALIGN 0x00000001 /* Must pass memory information to OS. */ -#define PUPA_MB_MEMORY_INFO 0x00000002 +#define GRUB_MB_MEMORY_INFO 0x00000002 /* Must pass video information to OS. */ -#define PUPA_MB_VIDEO_MODE 0x00000004 +#define GRUB_MB_VIDEO_MODE 0x00000004 /* This flag indicates the use of the address fields in the header. */ -#define PUPA_MB_AOUT_KLUDGE 0x00010000 +#define GRUB_MB_AOUT_KLUDGE 0x00010000 /* * Flags to be set in the 'flags' member of the multiboot info structure. */ /* is there basic lower/upper memory information? */ -#define PUPA_MB_INFO_MEMORY 0x00000001 +#define GRUB_MB_INFO_MEMORY 0x00000001 /* is there a boot device set? */ -#define PUPA_MB_INFO_BOOTDEV 0x00000002 +#define GRUB_MB_INFO_BOOTDEV 0x00000002 /* is the command-line defined? */ -#define PUPA_MB_INFO_CMDLINE 0x00000004 +#define GRUB_MB_INFO_CMDLINE 0x00000004 /* are there modules to do something with? */ -#define PUPA_MB_INFO_MODS 0x00000008 +#define GRUB_MB_INFO_MODS 0x00000008 /* These next two are mutually exclusive */ /* is there a symbol table loaded? */ -#define PUPA_MB_INFO_AOUT_SYMS 0x00000010 +#define GRUB_MB_INFO_AOUT_SYMS 0x00000010 /* is there an ELF section header table? */ -#define PUPA_MB_INFO_ELF_SHDR 0x00000020 +#define GRUB_MB_INFO_ELF_SHDR 0x00000020 /* is there a full memory map? */ -#define PUPA_MB_INFO_MEM_MAP 0x00000040 +#define GRUB_MB_INFO_MEM_MAP 0x00000040 /* Is there drive info? */ -#define PUPA_MB_INFO_DRIVE_INFO 0x00000080 +#define GRUB_MB_INFO_DRIVE_INFO 0x00000080 /* Is there a config table? */ -#define PUPA_MB_INFO_CONFIG_TABLE 0x00000100 +#define GRUB_MB_INFO_CONFIG_TABLE 0x00000100 /* Is there a boot loader name? */ -#define PUPA_MB_INFO_BOOT_LOADER_NAME 0x00000200 +#define GRUB_MB_INFO_BOOT_LOADER_NAME 0x00000200 /* Is there a APM table? */ -#define PUPA_MB_INFO_APM_TABLE 0x00000400 +#define GRUB_MB_INFO_APM_TABLE 0x00000400 /* Is there video information? */ -#define PUPA_MB_INFO_VIDEO_INFO 0x00000800 +#define GRUB_MB_INFO_VIDEO_INFO 0x00000800 #ifndef ASM_FILE -#include +#include -struct pupa_multiboot_header +struct grub_multiboot_header { - /* Must be PUPA_MB_MAGIC - see above. */ - pupa_uint32_t magic; + /* Must be GRUB_MB_MAGIC - see above. */ + grub_uint32_t magic; /* Feature flags. */ - pupa_uint32_t flags; + grub_uint32_t flags; /* The above fields plus this one must equal 0 mod 2^32. */ - pupa_uint32_t checksum; + grub_uint32_t checksum; - /* These are only valid if PUPA_MB_AOUT_KLUDGE is set. */ - pupa_uint32_t header_addr; - pupa_uint32_t load_addr; - pupa_uint32_t load_end_addr; - pupa_uint32_t bss_end_addr; - pupa_uint32_t entry_addr; + /* These are only valid if GRUB_MB_AOUT_KLUDGE is set. */ + grub_uint32_t header_addr; + grub_uint32_t load_addr; + grub_uint32_t load_end_addr; + grub_uint32_t bss_end_addr; + grub_uint32_t entry_addr; - /* These are only valid if PUPA_MB_VIDEO_MODE is set. */ - pupa_uint32_t mode_type; - pupa_uint32_t width; - pupa_uint32_t height; - pupa_uint32_t depth; + /* These are only valid if GRUB_MB_VIDEO_MODE is set. */ + grub_uint32_t mode_type; + grub_uint32_t width; + grub_uint32_t height; + grub_uint32_t depth; }; -struct pupa_multiboot_info +struct grub_multiboot_info { /* MultiBoot info version number */ - pupa_uint32_t flags; + grub_uint32_t flags; /* Available memory from BIOS */ - pupa_uint32_t mem_lower; - pupa_uint32_t mem_upper; + grub_uint32_t mem_lower; + grub_uint32_t mem_upper; /* "root" partition */ - pupa_uint32_t boot_device; + grub_uint32_t boot_device; /* Kernel command line */ - pupa_uint32_t cmdline; + grub_uint32_t cmdline; /* Boot-Module list */ - pupa_uint32_t mods_count; - pupa_uint32_t mods_addr; + grub_uint32_t mods_count; + grub_uint32_t mods_addr; - pupa_uint32_t syms[4]; + grub_uint32_t syms[4]; /* Memory Mapping buffer */ - pupa_uint32_t mmap_length; - pupa_uint32_t mmap_addr; + grub_uint32_t mmap_length; + grub_uint32_t mmap_addr; /* Drive Info buffer */ - pupa_uint32_t drives_length; - pupa_uint32_t drives_addr; + grub_uint32_t drives_length; + grub_uint32_t drives_addr; /* ROM configuration table */ - pupa_uint32_t config_table; + grub_uint32_t config_table; /* Boot Loader Name */ - pupa_uint32_t boot_loader_name; + grub_uint32_t boot_loader_name; /* APM table */ - pupa_uint32_t apm_table; + grub_uint32_t apm_table; /* Video */ - pupa_uint32_t vbe_control_info; - pupa_uint32_t vbe_mode_info; - pupa_uint16_t vbe_mode; - pupa_uint16_t vbe_interface_seg; - pupa_uint16_t vbe_interface_off; - pupa_uint16_t vbe_interface_len; + grub_uint32_t vbe_control_info; + grub_uint32_t vbe_mode_info; + grub_uint16_t vbe_mode; + grub_uint16_t vbe_interface_seg; + grub_uint16_t vbe_interface_off; + grub_uint16_t vbe_interface_len; }; -struct pupa_mod_list +struct grub_mod_list { /* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */ - pupa_uint32_t mod_start; - pupa_uint32_t mod_end; + grub_uint32_t mod_start; + grub_uint32_t mod_end; /* Module command line */ - pupa_uint32_t cmdline; + grub_uint32_t cmdline; /* padding to take it to 16 bytes (must be zero) */ - pupa_uint32_t pad; + grub_uint32_t pad; }; #endif /* ! ASM_FILE */ -#endif /* ! PUPA_MULTIBOOT_MACHINE_HEADER */ +#endif /* ! GRUB_MULTIBOOT_MACHINE_HEADER */ diff --git a/include/grub/i386/pc/partition.h b/include/grub/i386/pc/partition.h index ab9a3b769..f5f362598 100644 --- a/include/grub/i386/pc/partition.h +++ b/include/grub/i386/pc/partition.h @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,160 +13,160 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_PARTITION_HEADER -#define PUPA_PARTITION_HEADER 1 +#ifndef GRUB_PARTITION_HEADER +#define GRUB_PARTITION_HEADER 1 -#include -#include -#include +#include +#include +#include /* The signature. */ -#define PUPA_PARTITION_SIGNATURE 0xaa55 +#define GRUB_PARTITION_SIGNATURE 0xaa55 /* This is not a flag actually, but used as if it were a flag. */ -#define PUPA_PARTITION_TYPE_HIDDEN_FLAG 0x10 +#define GRUB_PARTITION_TYPE_HIDDEN_FLAG 0x10 /* DOS partition types. */ -#define PUPA_PARTITION_TYPE_NONE 0 -#define PUPA_PARTITION_TYPE_FAT12 1 -#define PUPA_PARTITION_TYPE_FAT16_LT32M 4 -#define PUPA_PARTITION_TYPE_EXTENDED 5 -#define PUPA_PARTITION_TYPE_FAT16_GT32M 6 -#define PUPA_PARTITION_TYPE_FAT32 0xb -#define PUPA_PARTITION_TYPE_FAT32_LBA 0xc -#define PUPA_PARTITION_TYPE_FAT16_LBA 0xe -#define PUPA_PARTITION_TYPE_WIN95_EXTENDED 0xf -#define PUPA_PARTITION_TYPE_EZD 0x55 -#define PUPA_PARTITION_TYPE_MINIX 0x80 -#define PUPA_PARTITION_TYPE_LINUX_MINIX 0x81 -#define PUPA_PARTITION_TYPE_EXT2FS 0x83 -#define PUPA_PARTITION_TYPE_LINUX_EXTENDED 0x85 -#define PUPA_PARTITION_TYPE_VSTAFS 0x9e -#define PUPA_PARTITION_TYPE_FREEBSD 0xa5 -#define PUPA_PARTITION_TYPE_OPENBSD 0xa6 -#define PUPA_PARTITION_TYPE_NETBSD 0xa9 -#define PUPA_PARTITION_TYPE_LINUX_RAID 0xfd +#define GRUB_PARTITION_TYPE_NONE 0 +#define GRUB_PARTITION_TYPE_FAT12 1 +#define GRUB_PARTITION_TYPE_FAT16_LT32M 4 +#define GRUB_PARTITION_TYPE_EXTENDED 5 +#define GRUB_PARTITION_TYPE_FAT16_GT32M 6 +#define GRUB_PARTITION_TYPE_FAT32 0xb +#define GRUB_PARTITION_TYPE_FAT32_LBA 0xc +#define GRUB_PARTITION_TYPE_FAT16_LBA 0xe +#define GRUB_PARTITION_TYPE_WIN95_EXTENDED 0xf +#define GRUB_PARTITION_TYPE_EZD 0x55 +#define GRUB_PARTITION_TYPE_MINIX 0x80 +#define GRUB_PARTITION_TYPE_LINUX_MINIX 0x81 +#define GRUB_PARTITION_TYPE_EXT2FS 0x83 +#define GRUB_PARTITION_TYPE_LINUX_EXTENDED 0x85 +#define GRUB_PARTITION_TYPE_VSTAFS 0x9e +#define GRUB_PARTITION_TYPE_FREEBSD 0xa5 +#define GRUB_PARTITION_TYPE_OPENBSD 0xa6 +#define GRUB_PARTITION_TYPE_NETBSD 0xa9 +#define GRUB_PARTITION_TYPE_LINUX_RAID 0xfd /* Constants for BSD disk label. */ -#define PUPA_PARTITION_BSD_LABEL_SECTOR 1 -#define PUPA_PARTITION_BSD_LABEL_MAGIC 0x82564557 -#define PUPA_PARTITION_BSD_MAX_ENTRIES 8 +#define GRUB_PARTITION_BSD_LABEL_SECTOR 1 +#define GRUB_PARTITION_BSD_LABEL_MAGIC 0x82564557 +#define GRUB_PARTITION_BSD_MAX_ENTRIES 8 /* BSD partition types. */ -#define PUPA_PARTITION_BSD_TYPE_UNUSED 0 -#define PUPA_PARTITION_BSD_TYPE_SWAP 1 -#define PUPA_PARTITION_BSD_TYPE_V6 2 -#define PUPA_PARTITION_BSD_TYPE_V7 3 -#define PUPA_PARTITION_BSD_TYPE_SYSV 4 -#define PUPA_PARTITION_BSD_TYPE_V71K 5 -#define PUPA_PARTITION_BSD_TYPE_V8 6 -#define PUPA_PARTITION_BSD_TYPE_BSDFFS 7 -#define PUPA_PARTITION_BSD_TYPE_MSDOS 8 -#define PUPA_PARTITION_BSD_TYPE_BSDLFS 9 -#define PUPA_PARTITION_BSD_TYPE_OTHER 10 -#define PUPA_PARTITION_BSD_TYPE_HPFS 11 -#define PUPA_PARTITION_BSD_TYPE_ISO9660 12 -#define PUPA_PARTITION_BSD_TYPE_BOOT 13 +#define GRUB_PARTITION_BSD_TYPE_UNUSED 0 +#define GRUB_PARTITION_BSD_TYPE_SWAP 1 +#define GRUB_PARTITION_BSD_TYPE_V6 2 +#define GRUB_PARTITION_BSD_TYPE_V7 3 +#define GRUB_PARTITION_BSD_TYPE_SYSV 4 +#define GRUB_PARTITION_BSD_TYPE_V71K 5 +#define GRUB_PARTITION_BSD_TYPE_V8 6 +#define GRUB_PARTITION_BSD_TYPE_BSDFFS 7 +#define GRUB_PARTITION_BSD_TYPE_MSDOS 8 +#define GRUB_PARTITION_BSD_TYPE_BSDLFS 9 +#define GRUB_PARTITION_BSD_TYPE_OTHER 10 +#define GRUB_PARTITION_BSD_TYPE_HPFS 11 +#define GRUB_PARTITION_BSD_TYPE_ISO9660 12 +#define GRUB_PARTITION_BSD_TYPE_BOOT 13 /* FreeBSD-specific types. */ -#define PUPA_PARTITION_FREEBSD_TYPE_VINUM 14 -#define PUPA_PARTITION_FREEBSD_TYPE_RAID 15 -#define PUPA_PARTITION_FREEBSD_TYPE_JFS2 21 +#define GRUB_PARTITION_FREEBSD_TYPE_VINUM 14 +#define GRUB_PARTITION_FREEBSD_TYPE_RAID 15 +#define GRUB_PARTITION_FREEBSD_TYPE_JFS2 21 /* NetBSD-specific types. */ -#define PUPA_PARTITION_NETBSD_TYPE_ADOS 14 -#define PUPA_PARTITION_NETBSD_TYPE_HFS 15 -#define PUPA_PARTITION_NETBSD_TYPE_FILECORE 16 -#define PUPA_PARTITION_NETBSD_TYPE_EXT2FS 17 -#define PUPA_PARTITION_NETBSD_TYPE_NTFS 18 -#define PUPA_PARTITION_NETBSD_TYPE_RAID 19 -#define PUPA_PARTITION_NETBSD_TYPE_CCD 20 -#define PUPA_PARTITION_NETBSD_TYPE_JFS2 21 -#define PUPA_PARTITION_NETBSD_TYPE_APPLEUFS 22 +#define GRUB_PARTITION_NETBSD_TYPE_ADOS 14 +#define GRUB_PARTITION_NETBSD_TYPE_HFS 15 +#define GRUB_PARTITION_NETBSD_TYPE_FILECORE 16 +#define GRUB_PARTITION_NETBSD_TYPE_EXT2FS 17 +#define GRUB_PARTITION_NETBSD_TYPE_NTFS 18 +#define GRUB_PARTITION_NETBSD_TYPE_RAID 19 +#define GRUB_PARTITION_NETBSD_TYPE_CCD 20 +#define GRUB_PARTITION_NETBSD_TYPE_JFS2 21 +#define GRUB_PARTITION_NETBSD_TYPE_APPLEUFS 22 /* OpenBSD-specific types. */ -#define PUPA_PARTITION_OPENBSD_TYPE_ADOS 14 -#define PUPA_PARTITION_OPENBSD_TYPE_HFS 15 -#define PUPA_PARTITION_OPENBSD_TYPE_FILECORE 16 -#define PUPA_PARTITION_OPENBSD_TYPE_EXT2FS 17 -#define PUPA_PARTITION_OPENBSD_TYPE_NTFS 18 -#define PUPA_PARTITION_OPENBSD_TYPE_RAID 19 +#define GRUB_PARTITION_OPENBSD_TYPE_ADOS 14 +#define GRUB_PARTITION_OPENBSD_TYPE_HFS 15 +#define GRUB_PARTITION_OPENBSD_TYPE_FILECORE 16 +#define GRUB_PARTITION_OPENBSD_TYPE_EXT2FS 17 +#define GRUB_PARTITION_OPENBSD_TYPE_NTFS 18 +#define GRUB_PARTITION_OPENBSD_TYPE_RAID 19 /* The BSD partition entry. */ -struct pupa_partition_bsd_entry +struct grub_partition_bsd_entry { - pupa_uint32_t size; - pupa_uint32_t offset; - pupa_uint32_t fragment_size; - pupa_uint8_t fs_type; - pupa_uint8_t fs_fragments; - pupa_uint16_t fs_cylinders; + grub_uint32_t size; + grub_uint32_t offset; + grub_uint32_t fragment_size; + grub_uint8_t fs_type; + grub_uint8_t fs_fragments; + grub_uint16_t fs_cylinders; } __attribute__ ((packed)); -/* The BSD disk label. Only define members useful for PUPA. */ -struct pupa_partition_disk_label +/* The BSD disk label. Only define members useful for GRUB. */ +struct grub_partition_disk_label { - pupa_uint32_t magic; - pupa_uint8_t padding[128]; - pupa_uint32_t magic2; - pupa_uint16_t checksum; - pupa_uint16_t num_partitions; - pupa_uint32_t boot_size; - pupa_uint32_t superblock_size; - struct pupa_partition_bsd_entry entries[PUPA_PARTITION_BSD_MAX_ENTRIES]; + grub_uint32_t magic; + grub_uint8_t padding[128]; + grub_uint32_t magic2; + grub_uint16_t checksum; + grub_uint16_t num_partitions; + grub_uint32_t boot_size; + grub_uint32_t superblock_size; + struct grub_partition_bsd_entry entries[GRUB_PARTITION_BSD_MAX_ENTRIES]; } __attribute__ ((packed)); /* The partition entry. */ -struct pupa_partition_entry +struct grub_partition_entry { /* If active, 0x80, otherwise, 0x00. */ - pupa_uint8_t flag; + grub_uint8_t flag; /* The head of the start. */ - pupa_uint8_t start_head; + grub_uint8_t start_head; /* (S | ((C >> 2) & 0xC0)) where S is the sector of the start and C is the cylinder of the start. Note that S is counted from one. */ - pupa_uint8_t start_sector; + grub_uint8_t start_sector; /* (C & 0xFF) where C is the cylinder of the start. */ - pupa_uint8_t start_cylinder; + grub_uint8_t start_cylinder; /* The partition type. */ - pupa_uint8_t type; + grub_uint8_t type; /* The end versions of start_head, start_sector and start_cylinder, respectively. */ - pupa_uint8_t end_head; - pupa_uint8_t end_sector; - pupa_uint8_t end_cylinder; + grub_uint8_t end_head; + grub_uint8_t end_sector; + grub_uint8_t end_cylinder; /* The start sector. Note that this is counted from zero. */ - pupa_uint32_t start; + grub_uint32_t start; /* The length in sector units. */ - pupa_uint32_t length; + grub_uint32_t length; } __attribute__ ((packed)); /* The structure of MBR. */ -struct pupa_partition_mbr +struct grub_partition_mbr { /* The code area (actually, including BPB). */ - pupa_uint8_t code[446]; + grub_uint8_t code[446]; /* Four partition entries. */ - struct pupa_partition_entry entries[4]; + struct grub_partition_entry entries[4]; /* The signature 0xaa55. */ - pupa_uint16_t signature; + grub_uint16_t signature; } __attribute__ ((packed)); /* Partition description. */ -struct pupa_partition +struct grub_partition { /* The start sector. */ unsigned long start; @@ -195,48 +195,48 @@ struct pupa_partition /* The BSD partition type. */ int bsd_type; }; -typedef struct pupa_partition *pupa_partition_t; +typedef struct grub_partition *grub_partition_t; -struct pupa_disk; +struct grub_disk; -pupa_partition_t EXPORT_FUNC(pupa_partition_probe) (struct pupa_disk *disk, +grub_partition_t EXPORT_FUNC(grub_partition_probe) (struct grub_disk *disk, const char *str); -pupa_err_t EXPORT_FUNC(pupa_partition_iterate) (struct pupa_disk *disk, - int (*hook) (const pupa_partition_t partition)); -char *EXPORT_FUNC(pupa_partition_get_name) (const pupa_partition_t partition); +grub_err_t EXPORT_FUNC(grub_partition_iterate) (struct grub_disk *disk, + int (*hook) (const grub_partition_t partition)); +char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition); static inline unsigned long -pupa_partition_get_start (const pupa_partition_t p) +grub_partition_get_start (const grub_partition_t p) { return p->start; } static inline unsigned long -pupa_partition_get_len (const pupa_partition_t p) +grub_partition_get_len (const grub_partition_t p) { return p->len; } static inline int -pupa_partition_is_empty (int type) +grub_partition_is_empty (int type) { - return (type == PUPA_PARTITION_TYPE_NONE); + return (type == GRUB_PARTITION_TYPE_NONE); } static inline int -pupa_partition_is_extended (int type) +grub_partition_is_extended (int type) { - return (type == PUPA_PARTITION_TYPE_EXTENDED - || type == PUPA_PARTITION_TYPE_WIN95_EXTENDED - || type == PUPA_PARTITION_TYPE_LINUX_EXTENDED); + return (type == GRUB_PARTITION_TYPE_EXTENDED + || type == GRUB_PARTITION_TYPE_WIN95_EXTENDED + || type == GRUB_PARTITION_TYPE_LINUX_EXTENDED); } static inline int -pupa_partition_is_bsd (int type) +grub_partition_is_bsd (int type) { - return (type == PUPA_PARTITION_TYPE_FREEBSD - || type == PUPA_PARTITION_TYPE_OPENBSD - || type == PUPA_PARTITION_TYPE_NETBSD); + return (type == GRUB_PARTITION_TYPE_FREEBSD + || type == GRUB_PARTITION_TYPE_OPENBSD + || type == GRUB_PARTITION_TYPE_NETBSD); } -#endif /* ! PUPA_PARTITION_HEADER */ +#endif /* ! GRUB_PARTITION_HEADER */ diff --git a/include/grub/i386/pc/time.h b/include/grub/i386/pc/time.h index 834df0d59..ccef12732 100644 --- a/include/grub/i386/pc/time.h +++ b/include/grub/i386/pc/time.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -20,14 +20,14 @@ #ifndef KERNEL_TIME_HEADER #define KERNEL_TIME_HEADER 1 -#ifdef PUPA_UTIL +#ifdef GRUB_UTIL # include -# define PUPA_TICKS_PER_SECOND CLOCKS_PER_SEC +# define GRUB_TICKS_PER_SECOND CLOCKS_PER_SEC #else -# define PUPA_TICKS_PER_SECOND 18 +# define GRUB_TICKS_PER_SECOND 18 #endif /* Return the real time in ticks. */ -pupa_uint32_t pupa_get_rtc (void); +grub_uint32_t grub_get_rtc (void); #endif /* ! KERNEL_TIME_HEADER */ diff --git a/include/grub/i386/pc/util/biosdisk.h b/include/grub/i386/pc/util/biosdisk.h index 2f8dc8941..a95fb4e7a 100644 --- a/include/grub/i386/pc/util/biosdisk.h +++ b/include/grub/i386/pc/util/biosdisk.h @@ -1,9 +1,9 @@ /* biosdisk.h - emulate biosdisk */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,15 +14,15 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_BIOSDISK_MACHINE_UTIL_HEADER -#define PUPA_BIOSDISK_MACHINE_UTIL_HEADER 1 +#ifndef GRUB_BIOSDISK_MACHINE_UTIL_HEADER +#define GRUB_BIOSDISK_MACHINE_UTIL_HEADER 1 -void pupa_util_biosdisk_init (const char *dev_map); -void pupa_util_biosdisk_fini (void); -char *pupa_util_biosdisk_get_pupa_dev (const char *os_dev); +void grub_util_biosdisk_init (const char *dev_map); +void grub_util_biosdisk_fini (void); +char *grub_util_biosdisk_get_grub_dev (const char *os_dev); -#endif /* ! PUPA_BIOSDISK_MACHINE_UTIL_HEADER */ +#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */ diff --git a/include/grub/i386/pc/vga.h b/include/grub/i386/pc/vga.h index fde0472a7..9b651f857 100644 --- a/include/grub/i386/pc/vga.h +++ b/include/grub/i386/pc/vga.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,15 +17,15 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_VGA_MACHINE_HEADER -#define PUPA_VGA_MACHINE_HEADER 1 +#ifndef GRUB_VGA_MACHINE_HEADER +#define GRUB_VGA_MACHINE_HEADER 1 -#include +#include /* Set the video mode to MODE and return the previous mode. */ -unsigned char EXPORT_FUNC(pupa_vga_set_mode) (unsigned char mode); +unsigned char EXPORT_FUNC(grub_vga_set_mode) (unsigned char mode); /* Return a pointer to the ROM font table. */ -unsigned char *EXPORT_FUNC(pupa_vga_get_font) (void); +unsigned char *EXPORT_FUNC(grub_vga_get_font) (void); -#endif /* ! PUPA_VGA_MACHINE_HEADER */ +#endif /* ! GRUB_VGA_MACHINE_HEADER */ diff --git a/include/grub/i386/setjmp.h b/include/grub/i386/setjmp.h index 1f25b19f0..b4923c506 100644 --- a/include/grub/i386/setjmp.h +++ b/include/grub/i386/setjmp.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,9 +17,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_SETJMP_CPU_HEADER -#define PUPA_SETJMP_CPU_HEADER 1 +#ifndef GRUB_SETJMP_CPU_HEADER +#define GRUB_SETJMP_CPU_HEADER 1 -typedef unsigned long pupa_jmp_buf[6]; +typedef unsigned long grub_jmp_buf[6]; -#endif /* ! PUPA_SETJMP_CPU_HEADER */ +#endif /* ! GRUB_SETJMP_CPU_HEADER */ diff --git a/include/grub/i386/types.h b/include/grub/i386/types.h index b2c5705b1..2190a8441 100644 --- a/include/grub/i386/types.h +++ b/include/grub/i386/types.h @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,20 +13,20 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_TYPES_CPU_HEADER -#define PUPA_TYPES_CPU_HEADER 1 +#ifndef GRUB_TYPES_CPU_HEADER +#define GRUB_TYPES_CPU_HEADER 1 /* The size of void *. */ -#define PUPA_HOST_SIZEOF_VOID_P 4 +#define GRUB_HOST_SIZEOF_VOID_P 4 /* The size of long. */ -#define PUPA_HOST_SIZEOF_LONG 4 +#define GRUB_HOST_SIZEOF_LONG 4 /* i386 is little-endian. */ -#undef PUPA_HOST_WORDS_BIGENDIAN +#undef GRUB_HOST_WORDS_BIGENDIAN -#endif /* ! PUPA_TYPES_CPU_HEADER */ +#endif /* ! GRUB_TYPES_CPU_HEADER */ diff --git a/include/grub/kernel.h b/include/grub/kernel.h index 24d89fbcb..8882d312c 100644 --- a/include/grub/kernel.h +++ b/include/grub/kernel.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,42 +17,42 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_KERNEL_HEADER -#define PUPA_KERNEL_HEADER 1 +#ifndef GRUB_KERNEL_HEADER +#define GRUB_KERNEL_HEADER 1 -#include +#include /* The module header. */ -struct pupa_module_header +struct grub_module_header { /* The offset of object code. */ - pupa_off_t offset; + grub_off_t offset; /* The size of object code plus this header. */ - pupa_size_t size; + grub_size_t size; }; /* The start address of the kernel. */ -extern pupa_addr_t pupa_start_addr; +extern grub_addr_t grub_start_addr; /* The end address of the kernel. */ -extern pupa_addr_t pupa_end_addr; +extern grub_addr_t grub_end_addr; /* The total size of modules including their headers. */ -extern pupa_size_t pupa_total_module_size; +extern grub_size_t grub_total_module_size; /* The size of the kernel image. */ -extern pupa_size_t pupa_kernel_image_size; +extern grub_size_t grub_kernel_image_size; /* The start point of the C code. */ -void pupa_main (void); +void grub_main (void); /* The machine-specific initialization. This must initialize memory. */ -void pupa_machine_init (void); +void grub_machine_init (void); /* Return the end address of the core image. */ -pupa_addr_t pupa_get_end_addr (void); +grub_addr_t grub_get_end_addr (void); /* Register all the exported symbols. This is automatically generated. */ -void pupa_register_exported_symbols (void); +void grub_register_exported_symbols (void); -#endif /* ! PUPA_KERNEL_HEADER */ +#endif /* ! GRUB_KERNEL_HEADER */ diff --git a/include/grub/loader.h b/include/grub/loader.h index 8d537bbb9..6ad8d7922 100644 --- a/include/grub/loader.h +++ b/include/grub/loader.h @@ -1,6 +1,6 @@ /* loader.h - OS loaders */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,21 +18,21 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_LOADER_HEADER -#define PUPA_LOADER_HEADER 1 +#ifndef GRUB_LOADER_HEADER +#define GRUB_LOADER_HEADER 1 -#include -#include -#include -#include +#include +#include +#include +#include -extern pupa_addr_t EXPORT_VAR(pupa_os_area_addr); -extern pupa_size_t EXPORT_VAR(pupa_os_area_size); +extern grub_addr_t EXPORT_VAR(grub_os_area_addr); +extern grub_size_t EXPORT_VAR(grub_os_area_size); -void EXPORT_FUNC(pupa_loader_set) (pupa_err_t (*boot) (void), - pupa_err_t (*unload) (void)); -void EXPORT_FUNC(pupa_loader_unset) (void); +void EXPORT_FUNC(grub_loader_set) (grub_err_t (*boot) (void), + grub_err_t (*unload) (void)); +void EXPORT_FUNC(grub_loader_unset) (void); -pupa_err_t EXPORT_FUNC(pupa_loader_boot) (void); +grub_err_t EXPORT_FUNC(grub_loader_boot) (void); -#endif /* ! PUPA_LOADER_HEADER */ +#endif /* ! GRUB_LOADER_HEADER */ diff --git a/include/grub/misc.h b/include/grub/misc.h index d096ac2c2..b1c687fe4 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -1,9 +1,9 @@ /* misc.h - prototypes for misc functions */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,51 +14,51 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_MISC_HEADER -#define PUPA_MISC_HEADER 1 +#ifndef GRUB_MISC_HEADER +#define GRUB_MISC_HEADER 1 #include -#include -#include -#include +#include +#include +#include -/* XXX: If pupa_memmove is too slow, we must implement pupa_memcpy. */ -#define pupa_memcpy(d,s,n) pupa_memmove ((d), (s), (n)) +/* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */ +#define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n)) -void *EXPORT_FUNC(pupa_memmove) (void *dest, const void *src, pupa_size_t n); -char *EXPORT_FUNC(pupa_strcpy) (char *dest, const char *src); -char *EXPORT_FUNC(pupa_strncpy) (char *dest, const char *src, int c); -char *EXPORT_FUNC(pupa_stpcpy) (char *dest, const char *src); -char *EXPORT_FUNC(pupa_strcat) (char *dest, const char *src); +void *EXPORT_FUNC(grub_memmove) (void *dest, const void *src, grub_size_t n); +char *EXPORT_FUNC(grub_strcpy) (char *dest, const char *src); +char *EXPORT_FUNC(grub_strncpy) (char *dest, const char *src, int c); +char *EXPORT_FUNC(grub_stpcpy) (char *dest, const char *src); +char *EXPORT_FUNC(grub_strcat) (char *dest, const char *src); -int EXPORT_FUNC(pupa_memcmp) (const void *s1, const void *s2, pupa_size_t n); -int EXPORT_FUNC(pupa_strcmp) (const char *s1, const char *s2); -int EXPORT_FUNC(pupa_strncmp) (const char *s1, const char *s2, int c); -char *EXPORT_FUNC(pupa_strchr) (const char *s, int c); -char *EXPORT_FUNC(pupa_strrchr) (const char *s, int c); -int EXPORT_FUNC(pupa_isspace) (int c); -int EXPORT_FUNC(pupa_isprint) (int c); -int EXPORT_FUNC(pupa_isalpha) (int c); -int EXPORT_FUNC(pupa_isgraph) (int c); -int EXPORT_FUNC(pupa_isdigit) (int c); -int EXPORT_FUNC(pupa_tolower) (int c); -unsigned long EXPORT_FUNC(pupa_strtoul) (const char *str, char **end, int base); -char *EXPORT_FUNC(pupa_strdup) (const char *s); -char *EXPORT_FUNC(pupa_strndup) (const char *s, pupa_size_t n); -void *EXPORT_FUNC(pupa_memset) (void *s, int c, pupa_size_t n); -pupa_size_t EXPORT_FUNC(pupa_strlen) (const char *s); -int EXPORT_FUNC(pupa_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); -int EXPORT_FUNC(pupa_vprintf) (const char *fmt, va_list args); -int EXPORT_FUNC(pupa_sprintf) (char *str, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); -int EXPORT_FUNC(pupa_vsprintf) (char *str, const char *fmt, va_list args); -void EXPORT_FUNC(pupa_stop) (void) __attribute__ ((noreturn)); -pupa_err_t EXPORT_FUNC(pupa_split_cmdline) (const char *str, - pupa_err_t (* getline) (char **), +int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n); +int EXPORT_FUNC(grub_strcmp) (const char *s1, const char *s2); +int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, int c); +char *EXPORT_FUNC(grub_strchr) (const char *s, int c); +char *EXPORT_FUNC(grub_strrchr) (const char *s, int c); +int EXPORT_FUNC(grub_isspace) (int c); +int EXPORT_FUNC(grub_isprint) (int c); +int EXPORT_FUNC(grub_isalpha) (int c); +int EXPORT_FUNC(grub_isgraph) (int c); +int EXPORT_FUNC(grub_isdigit) (int c); +int EXPORT_FUNC(grub_tolower) (int c); +unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, char **end, int base); +char *EXPORT_FUNC(grub_strdup) (const char *s); +char *EXPORT_FUNC(grub_strndup) (const char *s, grub_size_t n); +void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n); +grub_size_t EXPORT_FUNC(grub_strlen) (const char *s); +int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); +int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args); +int EXPORT_FUNC(grub_sprintf) (char *str, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); +int EXPORT_FUNC(grub_vsprintf) (char *str, const char *fmt, va_list args); +void EXPORT_FUNC(grub_stop) (void) __attribute__ ((noreturn)); +grub_err_t EXPORT_FUNC(grub_split_cmdline) (const char *str, + grub_err_t (* getline) (char **), int *argc, char ***argv); -#endif /* ! PUPA_MISC_HEADER */ +#endif /* ! GRUB_MISC_HEADER */ diff --git a/include/grub/mm.h b/include/grub/mm.h index 9bb0acf78..88877a9d0 100644 --- a/include/grub/mm.h +++ b/include/grub/mm.h @@ -1,9 +1,9 @@ /* mm.h - prototypes and declarations for memory manager */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,26 +14,26 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_MM_H -#define PUPA_MM_H 1 +#ifndef GRUB_MM_H +#define GRUB_MM_H 1 -#include -#include +#include +#include -void pupa_mm_init_region (void *addr, unsigned size); -void *EXPORT_FUNC(pupa_malloc) (unsigned size); -void EXPORT_FUNC(pupa_free) (void *ptr); -void *EXPORT_FUNC(pupa_realloc) (void *ptr, unsigned size); -void *EXPORT_FUNC(pupa_memalign) (unsigned align, unsigned size); +void grub_mm_init_region (void *addr, unsigned size); +void *EXPORT_FUNC(grub_malloc) (unsigned size); +void EXPORT_FUNC(grub_free) (void *ptr); +void *EXPORT_FUNC(grub_realloc) (void *ptr, unsigned size); +void *EXPORT_FUNC(grub_memalign) (unsigned align, unsigned size); /* For debugging. */ #define MM_DEBUG 1 #if MM_DEBUG -void pupa_mm_dump (unsigned lineno); +void grub_mm_dump (unsigned lineno); #endif -#endif /* ! PUPA_MM_H */ +#endif /* ! GRUB_MM_H */ diff --git a/include/grub/net.h b/include/grub/net.h index 85d4d8725..e011fc0ed 100644 --- a/include/grub/net.h +++ b/include/grub/net.h @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,49 +13,49 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_NET_HEADER -#define PUPA_NET_HEADER 1 +#ifndef GRUB_NET_HEADER +#define GRUB_NET_HEADER 1 -#include -#include -#include +#include +#include +#include -struct pupa_net; +struct grub_net; -struct pupa_net_dev +struct grub_net_dev { /* The device name. */ const char *name; /* FIXME: Just a template. */ - int (*probe) (struct pupa_net *net, const void *addr); - void (*reset) (struct pupa_net *net); - int (*poll) (struct pupa_net *net); - void (*transmit) (struct pupa_net *net, const void *destip, + int (*probe) (struct grub_net *net, const void *addr); + void (*reset) (struct grub_net *net); + int (*poll) (struct grub_net *net); + void (*transmit) (struct grub_net *net, const void *destip, unsigned srcsock, unsigned destsock, const void *packet); - void (*disable) (struct pupa_net *net); + void (*disable) (struct grub_net *net); /* The next net device. */ - struct pupa_net_dev *next; + struct grub_net_dev *next; }; -typedef struct pupa_net_dev *pupa_net_dev_t; +typedef struct grub_net_dev *grub_net_dev_t; -struct pupa_fs; +struct grub_fs; -struct pupa_net +struct grub_net { /* The net name. */ const char *name; /* The underlying disk device. */ - pupa_net_dev_t dev; + grub_net_dev_t dev; /* The binding filesystem. */ - struct pupa_fs *fs; + struct grub_fs *fs; /* FIXME: More data would be required, such as an IP address, a mask, a gateway, etc. */ @@ -63,11 +63,11 @@ struct pupa_net /* Device-specific data. */ void *data; }; -typedef struct pupa_net *pupa_net_t; +typedef struct grub_net *grub_net_t; /* FIXME: How to abstract networks? More consideration is necessary. */ /* Note: Networks are very different from disks, because networks must be initialized before used, and the status is persistent. */ -#endif /* ! PUPA_NET_HEADER */ +#endif /* ! GRUB_NET_HEADER */ diff --git a/include/grub/normal.h b/include/grub/normal.h index 1d1f7edce..14d0c5e1d 100644 --- a/include/grub/normal.h +++ b/include/grub/normal.h @@ -1,6 +1,6 @@ /* normal.h - prototypes for the normal mode */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,36 +18,36 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_NORMAL_HEADER -#define PUPA_NORMAL_HEADER 1 +#ifndef GRUB_NORMAL_HEADER +#define GRUB_NORMAL_HEADER 1 -#include -#include -#include -#include +#include +#include +#include +#include /* The maximum size of a command-line. */ -#define PUPA_MAX_CMDLINE 1600 +#define GRUB_MAX_CMDLINE 1600 /* Can be run in the command-line. */ -#define PUPA_COMMAND_FLAG_CMDLINE 0x1 +#define GRUB_COMMAND_FLAG_CMDLINE 0x1 /* Can be run in the menu. */ -#define PUPA_COMMAND_FLAG_MENU 0x2 +#define GRUB_COMMAND_FLAG_MENU 0x2 /* Can be run in both interfaces. */ -#define PUPA_COMMAND_FLAG_BOTH 0x3 +#define GRUB_COMMAND_FLAG_BOTH 0x3 /* Only for the command title. */ -#define PUPA_COMMAND_FLAG_TITLE 0x4 +#define GRUB_COMMAND_FLAG_TITLE 0x4 /* Don't print the command on booting. */ -#define PUPA_COMMAND_FLAG_NO_ECHO 0x8 +#define GRUB_COMMAND_FLAG_NO_ECHO 0x8 /* The command description. */ -struct pupa_command +struct grub_command { /* The name. */ const char *name; /* The callback function. */ - pupa_err_t (*func) (struct pupa_arg_list *state, int argc, char **args); + grub_err_t (*func) (struct grub_arg_list *state, int argc, char **args); /* The flags. */ unsigned flags; @@ -59,26 +59,26 @@ struct pupa_command const char *description; /* The argument parser optionlist. */ - const struct pupa_arg_option *options; + const struct grub_arg_option *options; /* The next element. */ - struct pupa_command *next; + struct grub_command *next; }; -typedef struct pupa_command *pupa_command_t; +typedef struct grub_command *grub_command_t; /* The command list. */ -struct pupa_command_list +struct grub_command_list { /* The string of a command. */ const char *command; /* The next element. */ - struct pupa_command_list *next; + struct grub_command_list *next; }; -typedef struct pupa_command_list *pupa_command_list_t; +typedef struct grub_command_list *grub_command_list_t; /* The menu entry. */ -struct pupa_menu_entry +struct grub_menu_entry { /* The title name. */ const char *title; @@ -87,15 +87,15 @@ struct pupa_menu_entry int num; /* The list of commands. */ - pupa_command_list_t command_list; + grub_command_list_t command_list; /* The next element. */ - struct pupa_menu_entry *next; + struct grub_menu_entry *next; }; -typedef struct pupa_menu_entry *pupa_menu_entry_t; +typedef struct grub_menu_entry *grub_menu_entry_t; /* The menu. */ -struct pupa_menu +struct grub_menu { /* The default entry number. */ int default_entry; @@ -110,52 +110,52 @@ struct pupa_menu int size; /* The list of menu entries. */ - pupa_menu_entry_t entry_list; + grub_menu_entry_t entry_list; }; -typedef struct pupa_menu *pupa_menu_t; +typedef struct grub_menu *grub_menu_t; /* To exit from the normal mode. */ -extern pupa_jmp_buf pupa_exit_env; +extern grub_jmp_buf grub_exit_env; -void pupa_enter_normal_mode (const char *config); -void pupa_normal_execute (const char *config, int nested); -void pupa_menu_run (pupa_menu_t menu, int nested); -void pupa_cmdline_run (int nested); -int pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, +void grub_enter_normal_mode (const char *config); +void grub_normal_execute (const char *config, int nested); +void grub_menu_run (grub_menu_t menu, int nested); +void grub_cmdline_run (int nested); +int grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, int echo_char, int readline); -void EXPORT_FUNC(pupa_register_command) (const char *name, - pupa_err_t (*func) (struct pupa_arg_list *state, +void EXPORT_FUNC(grub_register_command) (const char *name, + grub_err_t (*func) (struct grub_arg_list *state, int argc, char **args), unsigned flags, const char *summary, const char *description, - const struct pupa_arg_option *parser); -void EXPORT_FUNC(pupa_unregister_command) (const char *name); -pupa_command_t pupa_command_find (char *cmdline); -pupa_err_t pupa_set_history (int newsize); -int pupa_iterate_commands (int (*iterate) (pupa_command_t)); -int pupa_command_execute (char *cmdline); -void pupa_command_init (void); -void pupa_normal_init_page (void); -int pupa_arg_parse (pupa_command_t parser, int argc, char **argv, - struct pupa_arg_list *usr, char ***args, int *argnum); + const struct grub_arg_option *parser); +void EXPORT_FUNC(grub_unregister_command) (const char *name); +grub_command_t grub_command_find (char *cmdline); +grub_err_t grub_set_history (int newsize); +int grub_iterate_commands (int (*iterate) (grub_command_t)); +int grub_command_execute (char *cmdline); +void grub_command_init (void); +void grub_normal_init_page (void); +int grub_arg_parse (grub_command_t parser, int argc, char **argv, + struct grub_arg_list *usr, char ***args, int *argnum); -#ifdef PUPA_UTIL -void pupa_normal_init (void); -void pupa_normal_fini (void); -void pupa_hello_init (void); -void pupa_hello_fini (void); -void pupa_ls_init (void); -void pupa_ls_fini (void); -void pupa_cat_init (void); -void pupa_cat_fini (void); -void pupa_boot_init (void); -void pupa_boot_fini (void); -void pupa_cmp_init (void); -void pupa_cmp_fini (void); -void pupa_terminal_init (void); -void pupa_terminal_fini (void); +#ifdef GRUB_UTIL +void grub_normal_init (void); +void grub_normal_fini (void); +void grub_hello_init (void); +void grub_hello_fini (void); +void grub_ls_init (void); +void grub_ls_fini (void); +void grub_cat_init (void); +void grub_cat_fini (void); +void grub_boot_init (void); +void grub_boot_fini (void); +void grub_cmp_init (void); +void grub_cmp_fini (void); +void grub_terminal_init (void); +void grub_terminal_fini (void); #endif -#endif /* ! PUPA_NORMAL_HEADER */ +#endif /* ! GRUB_NORMAL_HEADER */ diff --git a/include/grub/powerpc/ieee1275/biosdisk.h b/include/grub/powerpc/ieee1275/biosdisk.h index 07cc54210..ea63be0f2 100644 --- a/include/grub/powerpc/ieee1275/biosdisk.h +++ b/include/grub/powerpc/ieee1275/biosdisk.h @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002, 2004 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,16 +13,16 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_BIOSDISK_MACHINE_HEADER -#define PUPA_BIOSDISK_MACHINE_HEADER 1 +#ifndef GRUB_BIOSDISK_MACHINE_HEADER +#define GRUB_BIOSDISK_MACHINE_HEADER 1 -#define PUPA_BIOSDISK_FLAG_LBA 1 +#define GRUB_BIOSDISK_FLAG_LBA 1 -struct pupa_biosdisk_data +struct grub_biosdisk_data { int drive; unsigned long cylinders; @@ -31,17 +31,17 @@ struct pupa_biosdisk_data unsigned long flags; }; -int pupa_biosdisk_rw_int13_extensions (int ah, int drive, void *dap); -int pupa_biosdisk_rw_standard (int ah, int drive, int coff, int hoff, +int grub_biosdisk_rw_int13_extensions (int ah, int drive, void *dap); +int grub_biosdisk_rw_standard (int ah, int drive, int coff, int hoff, int soff, int nsec, int segment); -int pupa_biosdisk_check_int13_extensions (int drive); -int pupa_biosdisk_get_diskinfo_int13_extensions (int drive, void *drp); -int pupa_biosdisk_get_diskinfo_standard (int drive, +int grub_biosdisk_check_int13_extensions (int drive); +int grub_biosdisk_get_diskinfo_int13_extensions (int drive, void *drp); +int grub_biosdisk_get_diskinfo_standard (int drive, unsigned long *cylinders, unsigned long *heads, unsigned long *sectors); -int pupa_biosdisk_get_num_floppies (void); +int grub_biosdisk_get_num_floppies (void); -void pupa_biosdisk_init (void); +void grub_biosdisk_init (void); -#endif /* ! PUPA_BIOSDISK_MACHINE_HEADER */ +#endif /* ! GRUB_BIOSDISK_MACHINE_HEADER */ diff --git a/include/grub/powerpc/ieee1275/console.h b/include/grub/powerpc/ieee1275/console.h index 4621acb40..e15420cf6 100644 --- a/include/grub/powerpc/ieee1275/console.h +++ b/include/grub/powerpc/ieee1275/console.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002, 2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,40 +17,40 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_CONSOLE_MACHINE_HEADER -#define PUPA_CONSOLE_MACHINE_HEADER 1 +#ifndef GRUB_CONSOLE_MACHINE_HEADER +#define GRUB_CONSOLE_MACHINE_HEADER 1 /* Define scan codes. */ -#define PUPA_CONSOLE_KEY_LEFT 0x4B00 -#define PUPA_CONSOLE_KEY_RIGHT 0x4D00 -#define PUPA_CONSOLE_KEY_UP 0x4800 -#define PUPA_CONSOLE_KEY_DOWN 0x5000 -#define PUPA_CONSOLE_KEY_IC 0x5200 -#define PUPA_CONSOLE_KEY_DC 0x5300 -#define PUPA_CONSOLE_KEY_BACKSPACE 0x0008 -#define PUPA_CONSOLE_KEY_HOME 0x4700 -#define PUPA_CONSOLE_KEY_END 0x4F00 -#define PUPA_CONSOLE_KEY_NPAGE 0x4900 -#define PUPA_CONSOLE_KEY_PPAGE 0x5100 +#define GRUB_CONSOLE_KEY_LEFT 0x4B00 +#define GRUB_CONSOLE_KEY_RIGHT 0x4D00 +#define GRUB_CONSOLE_KEY_UP 0x4800 +#define GRUB_CONSOLE_KEY_DOWN 0x5000 +#define GRUB_CONSOLE_KEY_IC 0x5200 +#define GRUB_CONSOLE_KEY_DC 0x5300 +#define GRUB_CONSOLE_KEY_BACKSPACE 0x0008 +#define GRUB_CONSOLE_KEY_HOME 0x4700 +#define GRUB_CONSOLE_KEY_END 0x4F00 +#define GRUB_CONSOLE_KEY_NPAGE 0x4900 +#define GRUB_CONSOLE_KEY_PPAGE 0x5100 #ifndef ASM_FILE -#include -#include +#include +#include /* These are global to share code between C and asm. */ -extern pupa_uint8_t pupa_console_cur_color; -void pupa_console_real_putchar (int c); -int EXPORT_FUNC(pupa_console_checkkey) (void); -int EXPORT_FUNC(pupa_console_getkey) (void); -pupa_uint16_t pupa_console_getxy (void); -void pupa_console_gotoxy (pupa_uint8_t x, pupa_uint8_t y); -void pupa_console_cls (void); -void pupa_console_setcursor (int on); +extern grub_uint8_t grub_console_cur_color; +void grub_console_real_putchar (int c); +int EXPORT_FUNC(grub_console_checkkey) (void); +int EXPORT_FUNC(grub_console_getkey) (void); +grub_uint16_t grub_console_getxy (void); +void grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y); +void grub_console_cls (void); +void grub_console_setcursor (int on); /* Initialize the console system. */ -void pupa_console_init (void); +void grub_console_init (void); #endif -#endif /* ! PUPA_CONSOLE_MACHINE_HEADER */ +#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */ diff --git a/include/grub/powerpc/ieee1275/ieee1275.h b/include/grub/powerpc/ieee1275/ieee1275.h index fb89cf34b..7f71fe98d 100644 --- a/include/grub/powerpc/ieee1275/ieee1275.h +++ b/include/grub/powerpc/ieee1275/ieee1275.h @@ -1,6 +1,6 @@ /* ieee1275.h - Access the Open Firmware client interface. */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003, 2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,82 +18,82 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_IEEE1275_MACHINE_HEADER -#define PUPA_IEEE1275_MACHINE_HEADER 1 +#ifndef GRUB_IEEE1275_MACHINE_HEADER +#define GRUB_IEEE1275_MACHINE_HEADER 1 #include -#include -#include +#include +#include /* Maps a device alias to a pathname. */ -struct pupa_ieee1275_devalias +struct grub_ieee1275_devalias { char *name; char *path; char *type; }; -struct pupa_ieee1275_mem_region +struct grub_ieee1275_mem_region { unsigned int start; unsigned int size; }; /* FIXME jrydberg: is this correct cell types? */ -typedef intptr_t pupa_ieee1275_ihandle_t; -typedef intptr_t pupa_ieee1275_phandle_t; +typedef intptr_t grub_ieee1275_ihandle_t; +typedef intptr_t grub_ieee1275_phandle_t; -extern intptr_t (*pupa_ieee1275_entry_fn) (void *); +extern intptr_t (*grub_ieee1275_entry_fn) (void *); -uint32_t EXPORT_FUNC(pupa_ieee1275_decode_int_4) (unsigned char *p); -int EXPORT_FUNC(pupa_ieee1275_finddevice) (char *name, - pupa_ieee1275_phandle_t *phandlep); -int EXPORT_FUNC(pupa_ieee1275_get_property) (int handle, const char *property, - void *buf, pupa_size_t size, - pupa_size_t *actual); -int EXPORT_FUNC(pupa_ieee1275_next_property) (int handle, char *prev_prop, +uint32_t EXPORT_FUNC(grub_ieee1275_decode_int_4) (unsigned char *p); +int EXPORT_FUNC(grub_ieee1275_finddevice) (char *name, + grub_ieee1275_phandle_t *phandlep); +int EXPORT_FUNC(grub_ieee1275_get_property) (int handle, const char *property, + void *buf, grub_size_t size, + grub_size_t *actual); +int EXPORT_FUNC(grub_ieee1275_next_property) (int handle, char *prev_prop, char *prop, int *flags); -int EXPORT_FUNC(pupa_ieee1275_get_property_length) - (pupa_ieee1275_phandle_t handle, const char *prop, pupa_size_t *length); -int EXPORT_FUNC(pupa_ieee1275_instance_to_package) - (pupa_ieee1275_ihandle_t ihandle, pupa_ieee1275_phandle_t *phandlep); -int EXPORT_FUNC(pupa_ieee1275_package_to_path) (pupa_ieee1275_phandle_t phandle, - char *path, pupa_size_t len, - pupa_size_t *actual); -int EXPORT_FUNC(pupa_ieee1275_instance_to_path) - (pupa_ieee1275_ihandle_t ihandle, char *path, pupa_size_t len, - pupa_size_t *actual); -int EXPORT_FUNC(pupa_ieee1275_write) (pupa_ieee1275_ihandle_t ihandle, - void *buffer, pupa_size_t len, - pupa_size_t *actualp); -int EXPORT_FUNC(pupa_ieee1275_read) (pupa_ieee1275_ihandle_t ihandle, - void *buffer, pupa_size_t len, - pupa_size_t *actualp); -int EXPORT_FUNC(pupa_ieee1275_seek) (pupa_ieee1275_ihandle_t ihandle, +int EXPORT_FUNC(grub_ieee1275_get_property_length) + (grub_ieee1275_phandle_t handle, const char *prop, grub_size_t *length); +int EXPORT_FUNC(grub_ieee1275_instance_to_package) + (grub_ieee1275_ihandle_t ihandle, grub_ieee1275_phandle_t *phandlep); +int EXPORT_FUNC(grub_ieee1275_package_to_path) (grub_ieee1275_phandle_t phandle, + char *path, grub_size_t len, + grub_size_t *actual); +int EXPORT_FUNC(grub_ieee1275_instance_to_path) + (grub_ieee1275_ihandle_t ihandle, char *path, grub_size_t len, + grub_size_t *actual); +int EXPORT_FUNC(grub_ieee1275_write) (grub_ieee1275_ihandle_t ihandle, + void *buffer, grub_size_t len, + grub_size_t *actualp); +int EXPORT_FUNC(grub_ieee1275_read) (grub_ieee1275_ihandle_t ihandle, + void *buffer, grub_size_t len, + grub_size_t *actualp); +int EXPORT_FUNC(grub_ieee1275_seek) (grub_ieee1275_ihandle_t ihandle, int pos_hi, int pos_lo, int *result); -int EXPORT_FUNC(pupa_ieee1275_peer) (pupa_ieee1275_phandle_t node, - pupa_ieee1275_phandle_t *result); -int EXPORT_FUNC(pupa_ieee1275_child) (pupa_ieee1275_phandle_t node, - pupa_ieee1275_phandle_t *result); -int EXPORT_FUNC(pupa_ieee1275_parent) (pupa_ieee1275_phandle_t node, - pupa_ieee1275_phandle_t *result); -int EXPORT_FUNC(pupa_ieee1275_exit) (void); -int EXPORT_FUNC(pupa_ieee1275_open) (char *node, - pupa_ieee1275_ihandle_t *result); -int EXPORT_FUNC(pupa_ieee1275_close) (pupa_ieee1275_ihandle_t ihandle); -int EXPORT_FUNC(pupa_ieee1275_claim) (void *p, pupa_size_t size, unsigned int align, +int EXPORT_FUNC(grub_ieee1275_peer) (grub_ieee1275_phandle_t node, + grub_ieee1275_phandle_t *result); +int EXPORT_FUNC(grub_ieee1275_child) (grub_ieee1275_phandle_t node, + grub_ieee1275_phandle_t *result); +int EXPORT_FUNC(grub_ieee1275_parent) (grub_ieee1275_phandle_t node, + grub_ieee1275_phandle_t *result); +int EXPORT_FUNC(grub_ieee1275_exit) (void); +int EXPORT_FUNC(grub_ieee1275_open) (char *node, + grub_ieee1275_ihandle_t *result); +int EXPORT_FUNC(grub_ieee1275_close) (grub_ieee1275_ihandle_t ihandle); +int EXPORT_FUNC(grub_ieee1275_claim) (void *p, grub_size_t size, unsigned int align, void **result); -int EXPORT_FUNC(pupa_ieee1275_set_property) (pupa_ieee1275_phandle_t phandle, +int EXPORT_FUNC(grub_ieee1275_set_property) (grub_ieee1275_phandle_t phandle, const char *propname, void *buf, - pupa_size_t size, - pupa_size_t *actual); -int EXPORT_FUNC(pupa_ieee1275_set_color) (pupa_ieee1275_ihandle_t ihandle, + grub_size_t size, + grub_size_t *actual); +int EXPORT_FUNC(grub_ieee1275_set_color) (grub_ieee1275_ihandle_t ihandle, int index, int r, int g, int b); -pupa_err_t EXPORT_FUNC(pupa_devalias_iterate) - (int (*hook) (struct pupa_ieee1275_devalias *alias)); +grub_err_t EXPORT_FUNC(grub_devalias_iterate) + (int (*hook) (struct grub_ieee1275_devalias *alias)); -#endif /* ! PUPA_IEEE1275_MACHINE_HEADER */ +#endif /* ! GRUB_IEEE1275_MACHINE_HEADER */ diff --git a/include/grub/powerpc/ieee1275/loader.h b/include/grub/powerpc/ieee1275/loader.h index 53c0268d4..29a23e73e 100644 --- a/include/grub/powerpc/ieee1275/loader.h +++ b/include/grub/powerpc/ieee1275/loader.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Yoshinori K. Okuji * Copyright (C) 2003 Jeroen Dekkers * @@ -18,34 +18,34 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_LOADER_MACHINE_HEADER -#define PUPA_LOADER_MACHINE_HEADER 1 +#ifndef GRUB_LOADER_MACHINE_HEADER +#define GRUB_LOADER_MACHINE_HEADER 1 -#include -#include -#include +#include +#include +#include -extern pupa_uint32_t EXPORT_VAR(pupa_linux_prot_size); -extern char *EXPORT_VAR(pupa_linux_tmp_addr); -extern char *EXPORT_VAR(pupa_linux_real_addr); +extern grub_uint32_t EXPORT_VAR(grub_linux_prot_size); +extern char *EXPORT_VAR(grub_linux_tmp_addr); +extern char *EXPORT_VAR(grub_linux_real_addr); -void EXPORT_FUNC(pupa_linux_boot_zimage) (void) __attribute__ ((noreturn)); -void EXPORT_FUNC(pupa_linux_boot_bzimage) (void) __attribute__ ((noreturn)); +void EXPORT_FUNC(grub_linux_boot_zimage) (void) __attribute__ ((noreturn)); +void EXPORT_FUNC(grub_linux_boot_bzimage) (void) __attribute__ ((noreturn)); /* This is an asm part of the chainloader. */ -void EXPORT_FUNC(pupa_chainloader_real_boot) (int drive, void *part_addr) __attribute__ ((noreturn)); +void EXPORT_FUNC(grub_chainloader_real_boot) (int drive, void *part_addr) __attribute__ ((noreturn)); /* The asm part of the multiboot loader. */ -void EXPORT_FUNC(pupa_multiboot_real_boot) (pupa_addr_t entry, - struct pupa_multiboot_info *mbi) +void EXPORT_FUNC(grub_multiboot_real_boot) (grub_addr_t entry, + struct grub_multiboot_info *mbi) __attribute__ ((noreturn)); /* It is necessary to export these functions, because normal mode commands reuse rescue mode commands. */ -void pupa_rescue_cmd_chainloader (int argc, char *argv[]); -void pupa_rescue_cmd_linux (int argc, char *argv[]); -void pupa_rescue_cmd_initrd (int argc, char *argv[]); -void pupa_rescue_cmd_multiboot (int argc, char *argv[]); -void pupa_rescue_cmd_module (int argc, char *argv[]); +void grub_rescue_cmd_chainloader (int argc, char *argv[]); +void grub_rescue_cmd_linux (int argc, char *argv[]); +void grub_rescue_cmd_initrd (int argc, char *argv[]); +void grub_rescue_cmd_multiboot (int argc, char *argv[]); +void grub_rescue_cmd_module (int argc, char *argv[]); -#endif /* ! PUPA_LOADER_MACHINE_HEADER */ +#endif /* ! GRUB_LOADER_MACHINE_HEADER */ diff --git a/include/grub/powerpc/ieee1275/multiboot.h b/include/grub/powerpc/ieee1275/multiboot.h index 5ad03fef5..784de482e 100644 --- a/include/grub/powerpc/ieee1275/multiboot.h +++ b/include/grub/powerpc/ieee1275/multiboot.h @@ -1,6 +1,6 @@ /* multiboot.h - multiboot header file. */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003, 2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,167 +18,167 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_MULTIBOOT_MACHINE_HEADER -#define PUPA_MULTIBOOT_MACHINE_HEADER 1 +#ifndef GRUB_MULTIBOOT_MACHINE_HEADER +#define GRUB_MULTIBOOT_MACHINE_HEADER 1 /* How many bytes from the start of the file we search for the header. */ -#define PUPA_MB_SEARCH 8192 +#define GRUB_MB_SEARCH 8192 /* The magic field should contain this. */ -#define PUPA_MB_MAGIC 0x1BADB002 +#define GRUB_MB_MAGIC 0x1BADB002 /* This should be in %eax. */ -#define PUPA_MB_MAGIC2 0x2BADB002 +#define GRUB_MB_MAGIC2 0x2BADB002 /* The bits in the required part of flags field we don't support. */ -#define PUPA_MB_UNSUPPORTED 0x0000fffc +#define GRUB_MB_UNSUPPORTED 0x0000fffc /* Alignment of multiboot modules. */ -#define PUPA_MB_MOD_ALIGN 0x00001000 +#define GRUB_MB_MOD_ALIGN 0x00001000 /* * Flags set in the 'flags' member of the multiboot header. */ /* Align all boot modules on i386 page (4KB) boundaries. */ -#define PUPA_MB_PAGE_ALIGN 0x00000001 +#define GRUB_MB_PAGE_ALIGN 0x00000001 /* Must pass memory information to OS. */ -#define PUPA_MB_MEMORY_INFO 0x00000002 +#define GRUB_MB_MEMORY_INFO 0x00000002 /* Must pass video information to OS. */ -#define PUPA_MB_VIDEO_MODE 0x00000004 +#define GRUB_MB_VIDEO_MODE 0x00000004 /* This flag indicates the use of the address fields in the header. */ -#define PUPA_MB_AOUT_KLUDGE 0x00010000 +#define GRUB_MB_AOUT_KLUDGE 0x00010000 /* * Flags to be set in the 'flags' member of the multiboot info structure. */ /* is there basic lower/upper memory information? */ -#define PUPA_MB_INFO_MEMORY 0x00000001 +#define GRUB_MB_INFO_MEMORY 0x00000001 /* is there a boot device set? */ -#define PUPA_MB_INFO_BOOTDEV 0x00000002 +#define GRUB_MB_INFO_BOOTDEV 0x00000002 /* is the command-line defined? */ -#define PUPA_MB_INFO_CMDLINE 0x00000004 +#define GRUB_MB_INFO_CMDLINE 0x00000004 /* are there modules to do something with? */ -#define PUPA_MB_INFO_MODS 0x00000008 +#define GRUB_MB_INFO_MODS 0x00000008 /* These next two are mutually exclusive */ /* is there a symbol table loaded? */ -#define PUPA_MB_INFO_AOUT_SYMS 0x00000010 +#define GRUB_MB_INFO_AOUT_SYMS 0x00000010 /* is there an ELF section header table? */ -#define PUPA_MB_INFO_ELF_SHDR 0x00000020 +#define GRUB_MB_INFO_ELF_SHDR 0x00000020 /* is there a full memory map? */ -#define PUPA_MB_INFO_MEM_MAP 0x00000040 +#define GRUB_MB_INFO_MEM_MAP 0x00000040 /* Is there drive info? */ -#define PUPA_MB_INFO_DRIVE_INFO 0x00000080 +#define GRUB_MB_INFO_DRIVE_INFO 0x00000080 /* Is there a config table? */ -#define PUPA_MB_INFO_CONFIG_TABLE 0x00000100 +#define GRUB_MB_INFO_CONFIG_TABLE 0x00000100 /* Is there a boot loader name? */ -#define PUPA_MB_INFO_BOOT_LOADER_NAME 0x00000200 +#define GRUB_MB_INFO_BOOT_LOADER_NAME 0x00000200 /* Is there a APM table? */ -#define PUPA_MB_INFO_APM_TABLE 0x00000400 +#define GRUB_MB_INFO_APM_TABLE 0x00000400 /* Is there video information? */ -#define PUPA_MB_INFO_VIDEO_INFO 0x00000800 +#define GRUB_MB_INFO_VIDEO_INFO 0x00000800 #ifndef ASM_FILE -#include +#include -struct pupa_multiboot_header +struct grub_multiboot_header { - /* Must be PUPA_MB_MAGIC - see above. */ - pupa_uint32_t magic; + /* Must be GRUB_MB_MAGIC - see above. */ + grub_uint32_t magic; /* Feature flags. */ - pupa_uint32_t flags; + grub_uint32_t flags; /* The above fields plus this one must equal 0 mod 2^32. */ - pupa_uint32_t checksum; + grub_uint32_t checksum; - /* These are only valid if PUPA_MB_AOUT_KLUDGE is set. */ - pupa_uint32_t header_addr; - pupa_uint32_t load_addr; - pupa_uint32_t load_end_addr; - pupa_uint32_t bss_end_addr; - pupa_uint32_t entry_addr; + /* These are only valid if GRUB_MB_AOUT_KLUDGE is set. */ + grub_uint32_t header_addr; + grub_uint32_t load_addr; + grub_uint32_t load_end_addr; + grub_uint32_t bss_end_addr; + grub_uint32_t entry_addr; - /* These are only valid if PUPA_MB_VIDEO_MODE is set. */ - pupa_uint32_t mode_type; - pupa_uint32_t width; - pupa_uint32_t height; - pupa_uint32_t depth; + /* These are only valid if GRUB_MB_VIDEO_MODE is set. */ + grub_uint32_t mode_type; + grub_uint32_t width; + grub_uint32_t height; + grub_uint32_t depth; }; -struct pupa_multiboot_info +struct grub_multiboot_info { /* MultiBoot info version number */ - pupa_uint32_t flags; + grub_uint32_t flags; /* Available memory from BIOS */ - pupa_uint32_t mem_lower; - pupa_uint32_t mem_upper; + grub_uint32_t mem_lower; + grub_uint32_t mem_upper; /* "root" partition */ - pupa_uint32_t boot_device; + grub_uint32_t boot_device; /* Kernel command line */ - pupa_uint32_t cmdline; + grub_uint32_t cmdline; /* Boot-Module list */ - pupa_uint32_t mods_count; - pupa_uint32_t mods_addr; + grub_uint32_t mods_count; + grub_uint32_t mods_addr; - pupa_uint32_t syms[4]; + grub_uint32_t syms[4]; /* Memory Mapping buffer */ - pupa_uint32_t mmap_length; - pupa_uint32_t mmap_addr; + grub_uint32_t mmap_length; + grub_uint32_t mmap_addr; /* Drive Info buffer */ - pupa_uint32_t drives_length; - pupa_uint32_t drives_addr; + grub_uint32_t drives_length; + grub_uint32_t drives_addr; /* ROM configuration table */ - pupa_uint32_t config_table; + grub_uint32_t config_table; /* Boot Loader Name */ - pupa_uint32_t boot_loader_name; + grub_uint32_t boot_loader_name; /* APM table */ - pupa_uint32_t apm_table; + grub_uint32_t apm_table; /* Video */ - pupa_uint32_t vbe_control_info; - pupa_uint32_t vbe_mode_info; - pupa_uint16_t vbe_mode; - pupa_uint16_t vbe_interface_seg; - pupa_uint16_t vbe_interface_off; - pupa_uint16_t vbe_interface_len; + grub_uint32_t vbe_control_info; + grub_uint32_t vbe_mode_info; + grub_uint16_t vbe_mode; + grub_uint16_t vbe_interface_seg; + grub_uint16_t vbe_interface_off; + grub_uint16_t vbe_interface_len; }; -struct pupa_mod_list +struct grub_mod_list { /* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */ - pupa_uint32_t mod_start; - pupa_uint32_t mod_end; + grub_uint32_t mod_start; + grub_uint32_t mod_end; /* Module command line */ - pupa_uint32_t cmdline; + grub_uint32_t cmdline; /* padding to take it to 16 bytes (must be zero) */ - pupa_uint32_t pad; + grub_uint32_t pad; }; #endif /* ! ASM_FILE */ -#endif /* ! PUPA_MULTIBOOT_MACHINE_HEADER */ +#endif /* ! GRUB_MULTIBOOT_MACHINE_HEADER */ diff --git a/include/grub/powerpc/ieee1275/partition.h b/include/grub/powerpc/ieee1275/partition.h index 781763ff1..aa3086473 100644 --- a/include/grub/powerpc/ieee1275/partition.h +++ b/include/grub/powerpc/ieee1275/partition.h @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,36 +13,36 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_PARTITION_HEADER -#define PUPA_PARTITION_HEADER 1 +#ifndef GRUB_PARTITION_HEADER +#define GRUB_PARTITION_HEADER 1 -#include -#include -#include +#include +#include +#include -#define PUPA_APPLE_PART_MAGIC 0x504D +#define GRUB_APPLE_PART_MAGIC 0x504D -struct pupa_apple_part +struct grub_apple_part { /* The magic number to idenify this as a partition, it should have the value `0x504D'. */ - pupa_uint16_t magic; + grub_uint16_t magic; /* Reserved. */ - pupa_uint16_t reserved; + grub_uint16_t reserved; /* The size of the partition map in blocks. */ - pupa_uint32_t partmap_size; + grub_uint32_t partmap_size; /* The first physical block of the partition. */ - pupa_uint32_t first_phys_block; + grub_uint32_t first_phys_block; /* The amount of blocks. */ - pupa_uint32_t blockcnt; + grub_uint32_t blockcnt; /* The partition name. */ char partname[32]; @@ -51,44 +51,44 @@ struct pupa_apple_part char parttype[32]; /* The first datablock of the partition. */ - pupa_uint32_t datablocks_first; + grub_uint32_t datablocks_first; /* The amount datablocks. */ - pupa_uint32_t datablocks_count; + grub_uint32_t datablocks_count; /* The status of the partition. (???) */ - pupa_uint32_t status; + grub_uint32_t status; /* The first block on which the bootcode can be found. */ - pupa_uint32_t bootcode_pos; + grub_uint32_t bootcode_pos; /* The size of the bootcode in bytes. */ - pupa_uint32_t bootcode_size; + grub_uint32_t bootcode_size; /* The load address of the bootcode. */ - pupa_uint32_t bootcode_loadaddr; + grub_uint32_t bootcode_loadaddr; /* Reserved. */ - pupa_uint32_t reserved2; + grub_uint32_t reserved2; /* The entrypoint of the bootcode. */ - pupa_uint32_t bootcode_entrypoint; + grub_uint32_t bootcode_entrypoint; /* Reserved. */ - pupa_uint32_t reserved3; + grub_uint32_t reserved3; /* A checksum of the bootcode. */ - pupa_uint32_t bootcode_checksum; + grub_uint32_t bootcode_checksum; /* The processor type. */ char processor[16]; /* Padding. */ - pupa_uint16_t pad[187]; + grub_uint16_t pad[187]; }; /* Partition description. */ -struct pupa_partition +struct grub_partition { /* The start sector. */ unsigned long start; @@ -114,27 +114,27 @@ struct pupa_partition /* The BSD partition type. */ int bsd_type; }; -typedef struct pupa_partition *pupa_partition_t; +typedef struct grub_partition *grub_partition_t; -struct pupa_disk; +struct grub_disk; -pupa_partition_t EXPORT_FUNC(pupa_partition_probe) (struct pupa_disk *disk, +grub_partition_t EXPORT_FUNC(grub_partition_probe) (struct grub_disk *disk, const char *str); -pupa_err_t EXPORT_FUNC(pupa_partition_iterate) (struct pupa_disk *disk, - int (*hook) (const pupa_partition_t partition)); -char *EXPORT_FUNC(pupa_partition_get_name) (const pupa_partition_t partition); +grub_err_t EXPORT_FUNC(grub_partition_iterate) (struct grub_disk *disk, + int (*hook) (const grub_partition_t partition)); +char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition); static inline unsigned long -pupa_partition_get_start (const pupa_partition_t p) +grub_partition_get_start (const grub_partition_t p) { return p->start; } static inline unsigned long -pupa_partition_get_len (const pupa_partition_t p) +grub_partition_get_len (const grub_partition_t p) { return p->len; } -#endif /* ! PUPA_PARTITION_HEADER */ +#endif /* ! GRUB_PARTITION_HEADER */ diff --git a/include/grub/powerpc/ieee1275/time.h b/include/grub/powerpc/ieee1275/time.h index 435a49f17..dafbef397 100644 --- a/include/grub/powerpc/ieee1275/time.h +++ b/include/grub/powerpc/ieee1275/time.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Marco Gerards * * This program is free software; you can redistribute it and/or modify @@ -20,14 +20,14 @@ #ifndef KERNEL_TIME_HEADER #define KERNEL_TIME_HEADER 1 -#ifdef PUPA_UTIL +#ifdef GRUB_UTIL # include -# define PUPA_TICKS_PER_SECOND CLOCKS_PER_SEC +# define GRUB_TICKS_PER_SECOND CLOCKS_PER_SEC #else -# define PUPA_TICKS_PER_SECOND 18 +# define GRUB_TICKS_PER_SECOND 18 #endif /* Return the real time in ticks. */ -pupa_uint32_t pupa_get_rtc (void); +grub_uint32_t grub_get_rtc (void); #endif /* ! KERNEL_TIME_HEADER */ diff --git a/include/grub/powerpc/ieee1275/util/biosdisk.h b/include/grub/powerpc/ieee1275/util/biosdisk.h index 49627a894..d8fc6fd21 100644 --- a/include/grub/powerpc/ieee1275/util/biosdisk.h +++ b/include/grub/powerpc/ieee1275/util/biosdisk.h @@ -1,9 +1,9 @@ /* biosdisk.h - emulate biosdisk */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002, 2004 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,15 +14,15 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_BIOSDISK_MACHINE_UTIL_HEADER -#define PUPA_BIOSDISK_MACHINE_UTIL_HEADER 1 +#ifndef GRUB_BIOSDISK_MACHINE_UTIL_HEADER +#define GRUB_BIOSDISK_MACHINE_UTIL_HEADER 1 -void pupa_util_biosdisk_init (const char *dev_map); -void pupa_util_biosdisk_fini (void); -char *pupa_util_biosdisk_get_pupa_dev (const char *os_dev); +void grub_util_biosdisk_init (const char *dev_map); +void grub_util_biosdisk_fini (void); +char *grub_util_biosdisk_get_grub_dev (const char *os_dev); -#endif /* ! PUPA_BIOSDISK_MACHINE_UTIL_HEADER */ +#endif /* ! GRUB_BIOSDISK_MACHINE_UTIL_HEADER */ diff --git a/include/grub/powerpc/setjmp.h b/include/grub/powerpc/setjmp.h index 05dfc098f..82fc272ab 100644 --- a/include/grub/powerpc/setjmp.h +++ b/include/grub/powerpc/setjmp.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002, 2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,9 +17,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_SETJMP_CPU_HEADER -#define PUPA_SETJMP_CPU_HEADER 1 +#ifndef GRUB_SETJMP_CPU_HEADER +#define GRUB_SETJMP_CPU_HEADER 1 -typedef unsigned long pupa_jmp_buf[6]; +typedef unsigned long grub_jmp_buf[6]; -#endif /* ! PUPA_SETJMP_CPU_HEADER */ +#endif /* ! GRUB_SETJMP_CPU_HEADER */ diff --git a/include/grub/powerpc/types.h b/include/grub/powerpc/types.h index bc3e24995..a089d5e52 100644 --- a/include/grub/powerpc/types.h +++ b/include/grub/powerpc/types.h @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002, 2004 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,20 +13,20 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_TYPES_CPU_HEADER -#define PUPA_TYPES_CPU_HEADER 1 +#ifndef GRUB_TYPES_CPU_HEADER +#define GRUB_TYPES_CPU_HEADER 1 /* The size of void *. */ -#define PUPA_HOST_SIZEOF_VOID_P 4 +#define GRUB_HOST_SIZEOF_VOID_P 4 /* The size of long. */ -#define PUPA_HOST_SIZEOF_LONG 4 +#define GRUB_HOST_SIZEOF_LONG 4 /* powerpc is little-endian. */ -#undef PUPA_HOST_WORDS_LITTLEENDIAN +#undef GRUB_HOST_WORDS_LITTLEENDIAN -#endif /* ! PUPA_TYPES_CPU_HEADER */ +#endif /* ! GRUB_TYPES_CPU_HEADER */ diff --git a/include/grub/rescue.h b/include/grub/rescue.h index af1c6df82..b8c4185ce 100644 --- a/include/grub/rescue.h +++ b/include/grub/rescue.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,21 +17,21 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_RESCUE_HEADER -#define PUPA_RESCUE_HEADER 1 +#ifndef GRUB_RESCUE_HEADER +#define GRUB_RESCUE_HEADER 1 -#include +#include /* Enter rescue mode. */ -void pupa_enter_rescue_mode (void); +void grub_enter_rescue_mode (void); /* Register a rescue mode command. */ -void EXPORT_FUNC(pupa_rescue_register_command) (const char *name, +void EXPORT_FUNC(grub_rescue_register_command) (const char *name, void (*func) (int argc, char *argv[]), const char *message); /* Unregister a rescue mode command. */ -void EXPORT_FUNC(pupa_rescue_unregister_command) (const char *name); +void EXPORT_FUNC(grub_rescue_unregister_command) (const char *name); -#endif /* ! PUPA_RESCUE_HEADER */ +#endif /* ! GRUB_RESCUE_HEADER */ diff --git a/include/grub/setjmp.h b/include/grub/setjmp.h index 5efd62cb9..698a5ded8 100644 --- a/include/grub/setjmp.h +++ b/include/grub/setjmp.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,20 +17,20 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_SETJMP_HEADER -#define PUPA_SETJMP_HEADER 1 +#ifndef GRUB_SETJMP_HEADER +#define GRUB_SETJMP_HEADER 1 -#ifdef PUPA_UTIL +#ifdef GRUB_UTIL #include -typedef jmp_buf pupa_jmp_buf; -#define pupa_setjmp setjmp -#define pupa_longjmp longjmp +typedef jmp_buf grub_jmp_buf; +#define grub_setjmp setjmp +#define grub_longjmp longjmp #else -/* This must define pupa_jmp_buf. */ -#include +/* This must define grub_jmp_buf. */ +#include -int pupa_setjmp (pupa_jmp_buf env); -void pupa_longjmp (pupa_jmp_buf env, int val) __attribute__ ((noreturn)); +int grub_setjmp (grub_jmp_buf env); +void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn)); #endif -#endif /* ! PUPA_SETJMP_HEADER */ +#endif /* ! GRUB_SETJMP_HEADER */ diff --git a/include/grub/symbol.h b/include/grub/symbol.h index 3c4378e49..8c392e86e 100644 --- a/include/grub/symbol.h +++ b/include/grub/symbol.h @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,12 +13,12 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_SYMBOL_HEADER -#define PUPA_SYMBOL_HEADER 1 +#ifndef GRUB_SYMBOL_HEADER +#define GRUB_SYMBOL_HEADER 1 #include @@ -36,4 +36,4 @@ #define EXPORT_FUNC(x) x #define EXPORT_VAR(x) x -#endif /* ! PUPA_SYMBOL_HEADER */ +#endif /* ! GRUB_SYMBOL_HEADER */ diff --git a/include/grub/term.h b/include/grub/term.h index f1ecdf7af..594648542 100644 --- a/include/grub/term.h +++ b/include/grub/term.h @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,29 +13,29 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_TERM_HEADER -#define PUPA_TERM_HEADER 1 +#ifndef GRUB_TERM_HEADER +#define GRUB_TERM_HEADER 1 -#include -#include -#include +#include +#include +#include /* These are used to represent the various color states we use. */ typedef enum { /* The color used to display all text that does not use the user defined colors below. */ - PUPA_TERM_COLOR_STANDARD, + GRUB_TERM_COLOR_STANDARD, /* The user defined colors for normal text. */ - PUPA_TERM_COLOR_NORMAL, + GRUB_TERM_COLOR_NORMAL, /* The user defined colors for highlighted text. */ - PUPA_TERM_COLOR_HIGHLIGHT + GRUB_TERM_COLOR_HIGHLIGHT } -pupa_term_color_state; +grub_term_color_state; /* Flags for representing the capabilities of a terminal. */ /* Some notes about the flags: @@ -47,27 +47,27 @@ pupa_term_color_state; to NULL. */ /* Set when input characters shouldn't be echoed back. */ -#define PUPA_TERM_NO_ECHO (1 << 0) +#define GRUB_TERM_NO_ECHO (1 << 0) /* Set when the editing feature should be disabled. */ -#define PUPA_TERM_NO_EDIT (1 << 1) +#define GRUB_TERM_NO_EDIT (1 << 1) /* Set when the terminal cannot do fancy things. */ -#define PUPA_TERM_DUMB (1 << 2) +#define GRUB_TERM_DUMB (1 << 2) /* Set when the terminal needs to be initialized. */ -#define PUPA_TERM_NEED_INIT (1 << 16) +#define GRUB_TERM_NEED_INIT (1 << 16) -struct pupa_term +struct grub_term { /* The terminal name. */ const char *name; /* Initialize the terminal. */ - pupa_err_t (*init) (void); + grub_err_t (*init) (void); /* Clean up the terminal. */ - pupa_err_t (*fini) (void); + grub_err_t (*fini) (void); /* Put a character. C is encoded in Unicode. */ - void (*putchar) (pupa_uint32_t c); + void (*putchar) (grub_uint32_t c); /* Check if any input character is available. */ int (*checkkey) (void); @@ -76,20 +76,20 @@ struct pupa_term int (*getkey) (void); /* Get the cursor position. The return value is ((X << 8) | Y). */ - pupa_uint16_t (*getxy) (void); + grub_uint16_t (*getxy) (void); /* Go to the position (X, Y). */ - void (*gotoxy) (pupa_uint8_t x, pupa_uint8_t y); + void (*gotoxy) (grub_uint8_t x, grub_uint8_t y); /* Clear the screen. */ void (*cls) (void); /* Set the current color to be used */ - void (*setcolorstate) (pupa_term_color_state state); + void (*setcolorstate) (grub_term_color_state state); /* Set the normal color and the highlight color. The format of each color is VGA's. */ - void (*setcolor) (pupa_uint8_t normal_color, pupa_uint8_t highlight_color); + void (*setcolor) (grub_uint8_t normal_color, grub_uint8_t highlight_color); /* Turn on/off the cursor. */ void (*setcursor) (int on); @@ -98,35 +98,35 @@ struct pupa_term void (*refresh) (void); /* The feature flags defined above. */ - pupa_uint32_t flags; + grub_uint32_t flags; /* The next terminal. */ - struct pupa_term *next; + struct grub_term *next; }; -typedef struct pupa_term *pupa_term_t; +typedef struct grub_term *grub_term_t; -void EXPORT_FUNC(pupa_term_register) (pupa_term_t term); -void EXPORT_FUNC(pupa_term_unregister) (pupa_term_t term); -void EXPORT_FUNC(pupa_term_iterate) (int (*hook) (pupa_term_t term)); +void EXPORT_FUNC(grub_term_register) (grub_term_t term); +void EXPORT_FUNC(grub_term_unregister) (grub_term_t term); +void EXPORT_FUNC(grub_term_iterate) (int (*hook) (grub_term_t term)); -pupa_err_t EXPORT_FUNC(pupa_term_set_current) (pupa_term_t term); -pupa_term_t EXPORT_FUNC(pupa_term_get_current) (void); +grub_err_t EXPORT_FUNC(grub_term_set_current) (grub_term_t term); +grub_term_t EXPORT_FUNC(grub_term_get_current) (void); -void EXPORT_FUNC(pupa_putchar) (int c); -void EXPORT_FUNC(pupa_putcode) (pupa_uint32_t code); -int EXPORT_FUNC(pupa_getkey) (void); -int EXPORT_FUNC(pupa_checkkey) (void); -pupa_uint16_t EXPORT_FUNC(pupa_getxy) (void); -void EXPORT_FUNC(pupa_gotoxy) (pupa_uint8_t x, pupa_uint8_t y); -void EXPORT_FUNC(pupa_cls) (void); -void EXPORT_FUNC(pupa_setcolorstate) (pupa_term_color_state state); -void EXPORT_FUNC(pupa_setcolor) (pupa_uint8_t normal_color, - pupa_uint8_t highlight_color); -int EXPORT_FUNC(pupa_setcursor) (int on); -void EXPORT_FUNC(pupa_refresh) (void); -void EXPORT_FUNC(pupa_set_more) (int onoff); +void EXPORT_FUNC(grub_putchar) (int c); +void EXPORT_FUNC(grub_putcode) (grub_uint32_t code); +int EXPORT_FUNC(grub_getkey) (void); +int EXPORT_FUNC(grub_checkkey) (void); +grub_uint16_t EXPORT_FUNC(grub_getxy) (void); +void EXPORT_FUNC(grub_gotoxy) (grub_uint8_t x, grub_uint8_t y); +void EXPORT_FUNC(grub_cls) (void); +void EXPORT_FUNC(grub_setcolorstate) (grub_term_color_state state); +void EXPORT_FUNC(grub_setcolor) (grub_uint8_t normal_color, + grub_uint8_t highlight_color); +int EXPORT_FUNC(grub_setcursor) (int on); +void EXPORT_FUNC(grub_refresh) (void); +void EXPORT_FUNC(grub_set_more) (int onoff); /* For convenience. */ -#define PUPA_TERM_ASCII_CHAR(c) ((c) & 0xff) +#define GRUB_TERM_ASCII_CHAR(c) ((c) & 0xff) -#endif /* ! PUPA_TERM_HEADER */ +#endif /* ! GRUB_TERM_HEADER */ diff --git a/include/grub/types.h b/include/grub/types.h index a9861ceb9..273370934 100644 --- a/include/grub/types.h +++ b/include/grub/types.h @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,125 +17,125 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_TYPES_HEADER -#define PUPA_TYPES_HEADER 1 +#ifndef GRUB_TYPES_HEADER +#define GRUB_TYPES_HEADER 1 #include -#include +#include -#ifdef PUPA_UTIL -# define PUPA_CPU_SIZEOF_VOID_P SIZEOF_VOID_P -# define PUPA_CPU_SIZEOF_LONG SIZEOF_LONG +#ifdef GRUB_UTIL +# define GRUB_CPU_SIZEOF_VOID_P SIZEOF_VOID_P +# define GRUB_CPU_SIZEOF_LONG SIZEOF_LONG # ifdef WORDS_BIGENDIAN -# define PUPA_CPU_WORDS_BIGENDIAN 1 +# define GRUB_CPU_WORDS_BIGENDIAN 1 # else -# undef PUPA_CPU_WORDS_BIGENDIAN +# undef GRUB_CPU_WORDS_BIGENDIAN # endif -#else /* ! PUPA_UTIL */ -# define PUPA_CPU_SIZEOF_VOID_P PUPA_HOST_SIZEOF_VOID_P -# define PUPA_CPU_SIZEOF_LONG PUPA_HOST_SIZEOF_LONG -# ifdef PUPA_HOST_WORDS_BIGENDIAN -# define PUPA_CPU_WORDS_BIGENDIAN 1 +#else /* ! GRUB_UTIL */ +# define GRUB_CPU_SIZEOF_VOID_P GRUB_HOST_SIZEOF_VOID_P +# define GRUB_CPU_SIZEOF_LONG GRUB_HOST_SIZEOF_LONG +# ifdef GRUB_HOST_WORDS_BIGENDIAN +# define GRUB_CPU_WORDS_BIGENDIAN 1 # else -# undef PUPA_CPU_WORDS_BIGENDIAN +# undef GRUB_CPU_WORDS_BIGENDIAN # endif -#endif /* ! PUPA_UTIL */ +#endif /* ! GRUB_UTIL */ -#if PUPA_CPU_SIZEOF_VOID_P != PUPA_CPU_SIZEOF_LONG +#if GRUB_CPU_SIZEOF_VOID_P != GRUB_CPU_SIZEOF_LONG # error "This architecture is not supported because sizeof(void *) != sizeof(long)" #endif -#if PUPA_CPU_SIZEOF_VOID_P != 4 && PUPA_CPU_SIZEOF_VOID_P != 8 +#if GRUB_CPU_SIZEOF_VOID_P != 4 && GRUB_CPU_SIZEOF_VOID_P != 8 # error "This architecture is not supported because sizeof(void *) != 4 and sizeof(void *) != 8" #endif /* Define various wide integers. */ -typedef signed char pupa_int8_t; -typedef short pupa_int16_t; -typedef int pupa_int32_t; -#if PUPA_CPU_SIZEOF_VOID_P == 8 -typedef long pupa_int64_t; +typedef signed char grub_int8_t; +typedef short grub_int16_t; +typedef int grub_int32_t; +#if GRUB_CPU_SIZEOF_VOID_P == 8 +typedef long grub_int64_t; #else -typedef long long pupa_int64_t; +typedef long long grub_int64_t; #endif -typedef unsigned char pupa_uint8_t; -typedef unsigned short pupa_uint16_t; -typedef unsigned pupa_uint32_t; -#if PUPA_CPU_SIZEOF_VOID_P == 8 -typedef unsigned long pupa_uint64_t; +typedef unsigned char grub_uint8_t; +typedef unsigned short grub_uint16_t; +typedef unsigned grub_uint32_t; +#if GRUB_CPU_SIZEOF_VOID_P == 8 +typedef unsigned long grub_uint64_t; #else -typedef unsigned long long pupa_uint64_t; +typedef unsigned long long grub_uint64_t; #endif /* Misc types. */ -#if PUPA_HOST_SIZEOF_VOID_P == 8 -typedef pupa_uint64_t pupa_addr_t; -typedef pupa_uint64_t pupa_off_t; -typedef pupa_uint64_t pupa_size_t; -typedef pupa_int64_t pupa_ssize_t; +#if GRUB_HOST_SIZEOF_VOID_P == 8 +typedef grub_uint64_t grub_addr_t; +typedef grub_uint64_t grub_off_t; +typedef grub_uint64_t grub_size_t; +typedef grub_int64_t grub_ssize_t; #else -typedef pupa_uint32_t pupa_addr_t; -typedef pupa_uint32_t pupa_off_t; -typedef pupa_uint32_t pupa_size_t; -typedef pupa_int32_t pupa_ssize_t; +typedef grub_uint32_t grub_addr_t; +typedef grub_uint32_t grub_off_t; +typedef grub_uint32_t grub_size_t; +typedef grub_int32_t grub_ssize_t; #endif /* Byte-orders. */ -#define pupa_swap_bytes16(x) \ +#define grub_swap_bytes16(x) \ ({ \ - pupa_uint16_t _x = (x); \ - (pupa_uint16_t) ((_x << 8) | (_x >> 8)); \ + grub_uint16_t _x = (x); \ + (grub_uint16_t) ((_x << 8) | (_x >> 8)); \ }) -#define pupa_swap_bytes32(x) \ +#define grub_swap_bytes32(x) \ ({ \ - pupa_uint32_t _x = (x); \ - (pupa_uint32_t) ((_x << 24) \ - | ((_x & (pupa_uint32_t) 0xFF00UL) << 8) \ - | ((_x & (pupa_uint32_t) 0xFF0000UL) >> 8) \ + grub_uint32_t _x = (x); \ + (grub_uint32_t) ((_x << 24) \ + | ((_x & (grub_uint32_t) 0xFF00UL) << 8) \ + | ((_x & (grub_uint32_t) 0xFF0000UL) >> 8) \ | (_x >> 24)); \ }) -#define pupa_swap_bytes64(x) \ +#define grub_swap_bytes64(x) \ ({ \ - pupa_uint64_t _x = (x); \ - (pupa_uint64_t) ((_x << 56) \ - | ((_x & (pupa_uint64_t) 0xFF00ULL) << 40) \ - | ((_x & (pupa_uint64_t) 0xFF0000ULL) << 24) \ - | ((_x & (pupa_uint64_t) 0xFF000000ULL) << 8) \ - | ((_x & (pupa_uint64_t) 0xFF00000000ULL) >> 8) \ - | ((_x & (pupa_uint64_t) 0xFF0000000000ULL) >> 24) \ - | ((_x & (pupa_uint64_t) 0xFF000000000000ULL) >> 40) \ + grub_uint64_t _x = (x); \ + (grub_uint64_t) ((_x << 56) \ + | ((_x & (grub_uint64_t) 0xFF00ULL) << 40) \ + | ((_x & (grub_uint64_t) 0xFF0000ULL) << 24) \ + | ((_x & (grub_uint64_t) 0xFF000000ULL) << 8) \ + | ((_x & (grub_uint64_t) 0xFF00000000ULL) >> 8) \ + | ((_x & (grub_uint64_t) 0xFF0000000000ULL) >> 24) \ + | ((_x & (grub_uint64_t) 0xFF000000000000ULL) >> 40) \ | (_x >> 56)); \ }) -#ifdef PUPA_CPU_WORDS_BIGENDIAN -# define pupa_cpu_to_le16(x) pupa_swap_bytes16(x) -# define pupa_cpu_to_le32(x) pupa_swap_bytes32(x) -# define pupa_cpu_to_le64(x) pupa_swap_bytes64(x) -# define pupa_le_to_cpu16(x) pupa_swap_bytes16(x) -# define pupa_le_to_cpu32(x) pupa_swap_bytes32(x) -# define pupa_le_to_cpu64(x) pupa_swap_bytes64(x) -# define pupa_cpu_to_be16(x) ((pupa_uint16_t) (x)) -# define pupa_cpu_to_be32(x) ((pupa_uint32_t) (x)) -# define pupa_cpu_to_be64(x) ((pupa_uint64_t) (x)) -# define pupa_be_to_cpu16(x) ((pupa_uint16_t) (x)) -# define pupa_be_to_cpu32(x) ((pupa_uint32_t) (x)) -# define pupa_be_to_cpu64(x) ((pupa_uint64_t) (x)) +#ifdef GRUB_CPU_WORDS_BIGENDIAN +# define grub_cpu_to_le16(x) grub_swap_bytes16(x) +# define grub_cpu_to_le32(x) grub_swap_bytes32(x) +# define grub_cpu_to_le64(x) grub_swap_bytes64(x) +# define grub_le_to_cpu16(x) grub_swap_bytes16(x) +# define grub_le_to_cpu32(x) grub_swap_bytes32(x) +# define grub_le_to_cpu64(x) grub_swap_bytes64(x) +# define grub_cpu_to_be16(x) ((grub_uint16_t) (x)) +# define grub_cpu_to_be32(x) ((grub_uint32_t) (x)) +# define grub_cpu_to_be64(x) ((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)) #else /* ! WORDS_BIGENDIAN */ -# define pupa_cpu_to_le16(x) ((pupa_uint16_t) (x)) -# define pupa_cpu_to_le32(x) ((pupa_uint32_t) (x)) -# define pupa_cpu_to_le64(x) ((pupa_uint64_t) (x)) -# define pupa_le_to_cpu16(x) ((pupa_uint16_t) (x)) -# define pupa_le_to_cpu32(x) ((pupa_uint32_t) (x)) -# define pupa_le_to_cpu64(x) ((pupa_uint64_t) (x)) -# define pupa_cpu_to_be16(x) pupa_swap_bytes16(x) -# define pupa_cpu_to_be32(x) pupa_swap_bytes32(x) -# define pupa_cpu_to_be64(x) pupa_swap_bytes64(x) -# define pupa_be_to_cpu16(x) pupa_swap_bytes16(x) -# define pupa_be_to_cpu32(x) pupa_swap_bytes32(x) -# define pupa_be_to_cpu64(x) pupa_swap_bytes64(x) +# define grub_cpu_to_le16(x) ((grub_uint16_t) (x)) +# define grub_cpu_to_le32(x) ((grub_uint32_t) (x)) +# define grub_cpu_to_le64(x) ((grub_uint64_t) (x)) +# define grub_le_to_cpu16(x) ((grub_uint16_t) (x)) +# define grub_le_to_cpu32(x) ((grub_uint32_t) (x)) +# define grub_le_to_cpu64(x) ((grub_uint64_t) (x)) +# define grub_cpu_to_be16(x) grub_swap_bytes16(x) +# define grub_cpu_to_be32(x) grub_swap_bytes32(x) +# define grub_cpu_to_be64(x) grub_swap_bytes64(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) #endif /* ! WORDS_BIGENDIAN */ -#endif /* ! PUPA_TYPES_HEADER */ +#endif /* ! GRUB_TYPES_HEADER */ diff --git a/include/grub/util/getroot.h b/include/grub/util/getroot.h index 74ca437a5..4fc1d6b3d 100644 --- a/include/grub/util/getroot.h +++ b/include/grub/util/getroot.h @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,14 +13,14 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_UTIL_GETROOT_HEADER -#define PUPA_UTIL_GETROOT_HEADER 1 +#ifndef GRUB_UTIL_GETROOT_HEADER +#define GRUB_UTIL_GETROOT_HEADER 1 -char *pupa_guess_root_device (const char *dir); -char *pupa_get_prefix (const char *dir); +char *grub_guess_root_device (const char *dir); +char *grub_get_prefix (const char *dir); -#endif /* ! PUPA_UTIL_GETROOT_HEADER */ +#endif /* ! GRUB_UTIL_GETROOT_HEADER */ diff --git a/include/grub/util/misc.h b/include/grub/util/misc.h index eef840a7b..148c99b36 100644 --- a/include/grub/util/misc.h +++ b/include/grub/util/misc.h @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,12 +13,12 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_UTIL_MISC_HEADER -#define PUPA_UTIL_MISC_HEADER 1 +#ifndef GRUB_UTIL_MISC_HEADER +#define GRUB_UTIL_MISC_HEADER 1 #include #include @@ -26,17 +26,17 @@ extern char *progname; extern int verbosity; -void pupa_util_info (const char *fmt, ...); -void pupa_util_error (const char *fmt, ...) __attribute__ ((noreturn)); +void grub_util_info (const char *fmt, ...); +void 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); -char *pupa_util_get_path (const char *dir, const char *file); -size_t pupa_util_get_image_size (const char *path); -char *pupa_util_read_image (const char *path); -void pupa_util_load_image (const char *path, char *buf); -void pupa_util_write_image (const char *img, size_t size, FILE *out); +char *grub_util_get_path (const char *dir, const char *file); +size_t grub_util_get_image_size (const char *path); +char *grub_util_read_image (const char *path); +void grub_util_load_image (const char *path, char *buf); +void grub_util_write_image (const char *img, size_t size, FILE *out); -#endif /* ! PUPA_UTIL_MISC_HEADER */ +#endif /* ! GRUB_UTIL_MISC_HEADER */ diff --git a/include/grub/util/resolve.h b/include/grub/util/resolve.h index b4b7e1e07..d015c73ea 100644 --- a/include/grub/util/resolve.h +++ b/include/grub/util/resolve.h @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,24 +13,24 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef PUPA_UTIL_RESOLVE_HEADER -#define PUPA_UTIL_RESOLVE_HEADER 1 +#ifndef GRUB_UTIL_RESOLVE_HEADER +#define GRUB_UTIL_RESOLVE_HEADER 1 -struct pupa_util_path_list +struct grub_util_path_list { const char *name; - struct pupa_util_path_list *next; + struct grub_util_path_list *next; }; /* Resolve the dependencies of the modules MODULES using the information in the file DEP_LIST_FILE. The directory PREFIX is used to find files. */ -struct pupa_util_path_list * -pupa_util_resolve_dependencies (const char *prefix, +struct grub_util_path_list * +grub_util_resolve_dependencies (const char *prefix, const char *dep_list_file, char *modules[]); -#endif /* ! PUPA_UTIL_RESOLVE_HEADER */ +#endif /* ! GRUB_UTIL_RESOLVE_HEADER */ diff --git a/kern/device.c b/kern/device.c index 9a04c0b72..61844f66f 100644 --- a/kern/device.c +++ b/kern/device.c @@ -1,9 +1,9 @@ /* device.c - device manager */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,62 +14,62 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include -static char *pupa_device_root; +static char *grub_device_root; -pupa_err_t -pupa_device_set_root (const char *name) +grub_err_t +grub_device_set_root (const char *name) { - pupa_free (pupa_device_root); - pupa_device_root = pupa_strdup (name); - return pupa_errno; + grub_free (grub_device_root); + grub_device_root = grub_strdup (name); + return grub_errno; } const char * -pupa_device_get_root (void) +grub_device_get_root (void) { - if (! pupa_device_root) - pupa_error (PUPA_ERR_BAD_DEVICE, "no root device"); + if (! grub_device_root) + grub_error (GRUB_ERR_BAD_DEVICE, "no root device"); - return pupa_device_root; + return grub_device_root; } -pupa_device_t -pupa_device_open (const char *name) +grub_device_t +grub_device_open (const char *name) { - pupa_disk_t disk = 0; - pupa_device_t dev = 0; + grub_disk_t disk = 0; + grub_device_t dev = 0; if (! name) { - if (! pupa_device_root) + if (! grub_device_root) { - pupa_error (PUPA_ERR_BAD_DEVICE, "no device is set"); + grub_error (GRUB_ERR_BAD_DEVICE, "no device is set"); goto fail; } - name = pupa_device_root; + name = grub_device_root; } - dev = pupa_malloc (sizeof (*dev)); + dev = grub_malloc (sizeof (*dev)); if (! dev) goto fail; /* Try to open a disk. */ - disk = pupa_disk_open (name); + disk = grub_disk_open (name); if (! disk) { - pupa_error (PUPA_ERR_BAD_DEVICE, "unknown device"); + grub_error (GRUB_ERR_BAD_DEVICE, "unknown device"); goto fail; } @@ -80,20 +80,20 @@ pupa_device_open (const char *name) fail: if (disk) - pupa_disk_close (disk); + grub_disk_close (disk); - pupa_free (dev); + grub_free (dev); return 0; } -pupa_err_t -pupa_device_close (pupa_device_t device) +grub_err_t +grub_device_close (grub_device_t device) { if (device->disk) - pupa_disk_close (device->disk); + grub_disk_close (device->disk); - pupa_free (device); + grub_free (device); - return pupa_errno; + return grub_errno; } diff --git a/kern/disk.c b/kern/disk.c index ed514afed..8ac3a9295 100644 --- a/kern/disk.c +++ b/kern/disk.c @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,27 +13,27 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include -#define PUPA_CACHE_TIMEOUT 2 +#define GRUB_CACHE_TIMEOUT 2 /* The last time the disk was used. */ -static unsigned long pupa_last_time = 0; +static unsigned long grub_last_time = 0; /* Disk cache. */ -struct pupa_disk_cache +struct grub_disk_cache { unsigned long id; unsigned long sector; @@ -41,142 +41,142 @@ struct pupa_disk_cache int lock; }; -static struct pupa_disk_cache pupa_disk_cache_table[PUPA_DISK_CACHE_NUM]; +static struct grub_disk_cache grub_disk_cache_table[GRUB_DISK_CACHE_NUM]; #if 0 -static unsigned long pupa_disk_cache_hits; -static unsigned long pupa_disk_cache_misses; +static unsigned long grub_disk_cache_hits; +static unsigned long grub_disk_cache_misses; void -pupa_disk_cache_get_performance (unsigned long *hits, unsigned long *misses) +grub_disk_cache_get_performance (unsigned long *hits, unsigned long *misses) { - *hits = pupa_disk_cache_hits; - *misses = pupa_disk_cache_misses; + *hits = grub_disk_cache_hits; + *misses = grub_disk_cache_misses; } #endif static unsigned -pupa_disk_cache_get_index (unsigned long id, unsigned long sector) +grub_disk_cache_get_index (unsigned long id, unsigned long sector) { - return ((id * 2606459 + (sector >> PUPA_DISK_CACHE_BITS)) - % PUPA_DISK_CACHE_NUM); + return ((id * 2606459 + (sector >> GRUB_DISK_CACHE_BITS)) + % GRUB_DISK_CACHE_NUM); } static void -pupa_disk_cache_invalidate (unsigned long id, unsigned long sector) +grub_disk_cache_invalidate (unsigned long id, unsigned long sector) { unsigned index; - struct pupa_disk_cache *cache; + struct grub_disk_cache *cache; - sector &= ~(PUPA_DISK_CACHE_SIZE - 1); - index = pupa_disk_cache_get_index (id, sector); - cache = pupa_disk_cache_table + index; + sector &= ~(GRUB_DISK_CACHE_SIZE - 1); + index = grub_disk_cache_get_index (id, sector); + cache = grub_disk_cache_table + index; if (cache->id == id && cache->sector == sector && cache->data) { cache->lock = 1; - pupa_free (cache->data); + grub_free (cache->data); cache->data = 0; cache->lock = 0; } } void -pupa_disk_cache_invalidate_all (void) +grub_disk_cache_invalidate_all (void) { unsigned i; - for (i = 0; i < PUPA_DISK_CACHE_NUM; i++) + for (i = 0; i < GRUB_DISK_CACHE_NUM; i++) { - struct pupa_disk_cache *cache = pupa_disk_cache_table + i; + struct grub_disk_cache *cache = grub_disk_cache_table + i; if (cache->data && ! cache->lock) { - pupa_free (cache->data); + grub_free (cache->data); cache->data = 0; } } } static char * -pupa_disk_cache_fetch (unsigned long id, unsigned long sector) +grub_disk_cache_fetch (unsigned long id, unsigned long sector) { - struct pupa_disk_cache *cache; + struct grub_disk_cache *cache; unsigned index; - index = pupa_disk_cache_get_index (id, sector); - cache = pupa_disk_cache_table + index; + index = grub_disk_cache_get_index (id, sector); + cache = grub_disk_cache_table + index; if (cache->id == id && cache->sector == sector) { cache->lock = 1; #if 0 - pupa_disk_cache_hits++; + grub_disk_cache_hits++; #endif return cache->data; } #if 0 - pupa_disk_cache_misses++; + grub_disk_cache_misses++; #endif return 0; } static void -pupa_disk_cache_unlock (unsigned long id, unsigned long sector) +grub_disk_cache_unlock (unsigned long id, unsigned long sector) { - struct pupa_disk_cache *cache; + struct grub_disk_cache *cache; unsigned index; - index = pupa_disk_cache_get_index (id, sector); - cache = pupa_disk_cache_table + index; + index = grub_disk_cache_get_index (id, sector); + cache = grub_disk_cache_table + index; if (cache->id == id && cache->sector == sector) cache->lock = 0; } -static pupa_err_t -pupa_disk_cache_store (unsigned long id, unsigned long sector, +static grub_err_t +grub_disk_cache_store (unsigned long id, unsigned long sector, const char *data) { unsigned index; - struct pupa_disk_cache *cache; + struct grub_disk_cache *cache; - pupa_disk_cache_invalidate (id, sector); + grub_disk_cache_invalidate (id, sector); - index = pupa_disk_cache_get_index (id, sector); - cache = pupa_disk_cache_table + index; + index = grub_disk_cache_get_index (id, sector); + cache = grub_disk_cache_table + index; - cache->data = pupa_malloc (PUPA_DISK_SECTOR_SIZE << PUPA_DISK_CACHE_BITS); + cache->data = grub_malloc (GRUB_DISK_SECTOR_SIZE << GRUB_DISK_CACHE_BITS); if (! cache->data) - return pupa_errno; + return grub_errno; - pupa_memcpy (cache->data, data, - PUPA_DISK_SECTOR_SIZE << PUPA_DISK_CACHE_BITS); + grub_memcpy (cache->data, data, + GRUB_DISK_SECTOR_SIZE << GRUB_DISK_CACHE_BITS); cache->id = id; cache->sector = sector; - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } -static pupa_disk_dev_t pupa_disk_dev_list; +static grub_disk_dev_t grub_disk_dev_list; void -pupa_disk_dev_register (pupa_disk_dev_t dev) +grub_disk_dev_register (grub_disk_dev_t dev) { - dev->next = pupa_disk_dev_list; - pupa_disk_dev_list = dev; + dev->next = grub_disk_dev_list; + grub_disk_dev_list = dev; } void -pupa_disk_dev_unregister (pupa_disk_dev_t dev) +grub_disk_dev_unregister (grub_disk_dev_t dev) { - pupa_disk_dev_t *p, q; + grub_disk_dev_t *p, q; - for (p = &pupa_disk_dev_list, q = *p; q; p = &(q->next), q = q->next) + for (p = &grub_disk_dev_list, q = *p; q; p = &(q->next), q = q->next) if (q == dev) { *p = q->next; @@ -185,25 +185,25 @@ pupa_disk_dev_unregister (pupa_disk_dev_t dev) } void -pupa_disk_dev_iterate (int (*hook) (const char *name)) +grub_disk_dev_iterate (int (*hook) (const char *name)) { - pupa_disk_dev_t p; + grub_disk_dev_t p; - for (p = pupa_disk_dev_list; p; p = p->next) + for (p = grub_disk_dev_list; p; p = p->next) if ((p->iterate) (hook)) break; } -pupa_disk_t -pupa_disk_open (const char *name) +grub_disk_t +grub_disk_open (const char *name) { char *p; - pupa_disk_t disk; - pupa_disk_dev_t dev; + grub_disk_t disk; + grub_disk_dev_t dev; char *raw = (char *) name; unsigned long current_time; - disk = (pupa_disk_t) pupa_malloc (sizeof (*disk)); + disk = (grub_disk_t) grub_malloc (sizeof (*disk)); if (! disk) return 0; @@ -211,67 +211,67 @@ pupa_disk_open (const char *name) disk->read_hook = 0; disk->partition = 0; disk->data = 0; - disk->name = pupa_strdup (name); + disk->name = grub_strdup (name); if (! disk->name) goto fail; - p = pupa_strchr (name, ','); + p = grub_strchr (name, ','); if (p) { - pupa_size_t len = p - name; + grub_size_t len = p - name; - raw = pupa_malloc (len + 1); + raw = grub_malloc (len + 1); if (! raw) goto fail; - pupa_memcpy (raw, name, len); + grub_memcpy (raw, name, len); raw[len] = '\0'; } - for (dev = pupa_disk_dev_list; dev; dev = dev->next) + for (dev = grub_disk_dev_list; dev; dev = dev->next) { - if ((dev->open) (raw, disk) == PUPA_ERR_NONE) + if ((dev->open) (raw, disk) == GRUB_ERR_NONE) break; - else if (pupa_errno == PUPA_ERR_UNKNOWN_DEVICE) - pupa_errno = PUPA_ERR_NONE; + else if (grub_errno == GRUB_ERR_UNKNOWN_DEVICE) + grub_errno = GRUB_ERR_NONE; else goto fail; } if (! dev) { - pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "no such disk"); + grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no such disk"); goto fail; } if (p && ! disk->has_partitions) { - pupa_error (PUPA_ERR_BAD_DEVICE, "no partition on this disk"); + grub_error (GRUB_ERR_BAD_DEVICE, "no partition on this disk"); goto fail; } disk->dev = dev; if (p) - disk->partition = pupa_partition_probe (disk, p + 1); + disk->partition = grub_partition_probe (disk, p + 1); /* The cache will be invalidated about 2 seconds after a device was closed. */ - current_time = pupa_get_rtc (); + current_time = grub_get_rtc (); - if (current_time > pupa_last_time + PUPA_CACHE_TIMEOUT * PUPA_TICKS_PER_SECOND) - pupa_disk_cache_invalidate_all (); + if (current_time > grub_last_time + GRUB_CACHE_TIMEOUT * GRUB_TICKS_PER_SECOND) + grub_disk_cache_invalidate_all (); - pupa_last_time = current_time; + grub_last_time = current_time; fail: if (raw && raw != name) - pupa_free (raw); + grub_free (raw); - if (pupa_errno != PUPA_ERR_NONE) + if (grub_errno != GRUB_ERR_NONE) { - pupa_disk_close (disk); + grub_disk_close (disk); return 0; } @@ -279,64 +279,64 @@ pupa_disk_open (const char *name) } void -pupa_disk_close (pupa_disk_t disk) +grub_disk_close (grub_disk_t disk) { if (disk->dev && disk->dev->close) (disk->dev->close) (disk); /* Reset the timer. */ - pupa_last_time = pupa_get_rtc (); + grub_last_time = grub_get_rtc (); - pupa_free (disk->partition); - pupa_free ((void *) disk->name); - pupa_free (disk); + grub_free (disk->partition); + grub_free ((void *) disk->name); + grub_free (disk); } -static pupa_err_t -pupa_disk_check_range (pupa_disk_t disk, unsigned long *sector, - unsigned long *offset, pupa_ssize_t size) +static grub_err_t +grub_disk_check_range (grub_disk_t disk, unsigned long *sector, + unsigned long *offset, grub_ssize_t size) { - *sector += *offset >> PUPA_DISK_SECTOR_BITS; - *offset &= PUPA_DISK_SECTOR_SIZE - 1; + *sector += *offset >> GRUB_DISK_SECTOR_BITS; + *offset &= GRUB_DISK_SECTOR_SIZE - 1; if (disk->partition) { unsigned long start, len; - start = pupa_partition_get_start (disk->partition); - len = pupa_partition_get_len (disk->partition); + start = grub_partition_get_start (disk->partition); + len = grub_partition_get_len (disk->partition); if (*sector >= len - || len - *sector < ((*offset + size + PUPA_DISK_SECTOR_SIZE - 1) - >> PUPA_DISK_SECTOR_BITS)) - return pupa_error (PUPA_ERR_OUT_OF_RANGE, "out of partition"); + || len - *sector < ((*offset + size + GRUB_DISK_SECTOR_SIZE - 1) + >> GRUB_DISK_SECTOR_BITS)) + return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of partition"); *sector += start; } if (disk->total_sectors <= *sector - || ((*offset + size + PUPA_DISK_SECTOR_SIZE - 1) - >> PUPA_DISK_SECTOR_BITS) > disk->total_sectors - *sector) - return pupa_error (PUPA_ERR_OUT_OF_RANGE, "out of disk"); + || ((*offset + size + GRUB_DISK_SECTOR_SIZE - 1) + >> GRUB_DISK_SECTOR_BITS) > disk->total_sectors - *sector) + return grub_error (GRUB_ERR_OUT_OF_RANGE, "out of disk"); - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } /* Read data from the disk. */ -pupa_err_t -pupa_disk_read (pupa_disk_t disk, unsigned long sector, +grub_err_t +grub_disk_read (grub_disk_t disk, unsigned long sector, unsigned long offset, unsigned long size, char *buf) { char *tmp_buf; /* First of all, check if the region is within the disk. */ - if (pupa_disk_check_range (disk, §or, &offset, size) != PUPA_ERR_NONE) - return pupa_errno; + if (grub_disk_check_range (disk, §or, &offset, size) != GRUB_ERR_NONE) + return grub_errno; /* Allocate a temporary buffer. */ - tmp_buf = pupa_malloc (PUPA_DISK_SECTOR_SIZE << PUPA_DISK_CACHE_BITS); + tmp_buf = grub_malloc (GRUB_DISK_SECTOR_SIZE << GRUB_DISK_CACHE_BITS); if (! tmp_buf) - return pupa_errno; + return grub_errno; /* Until SIZE is zero... */ while (size) @@ -347,54 +347,54 @@ pupa_disk_read (pupa_disk_t disk, unsigned long sector, unsigned long pos; /* For reading bulk data. */ - start_sector = sector & ~(PUPA_DISK_CACHE_SIZE - 1); - pos = (sector - start_sector) << PUPA_DISK_SECTOR_BITS; - len = (PUPA_DISK_SECTOR_SIZE << PUPA_DISK_CACHE_BITS) - pos - offset; + start_sector = sector & ~(GRUB_DISK_CACHE_SIZE - 1); + pos = (sector - start_sector) << GRUB_DISK_SECTOR_BITS; + len = (GRUB_DISK_SECTOR_SIZE << GRUB_DISK_CACHE_BITS) - pos - offset; if (len > size) len = size; /* Fetch the cache. */ - data = pupa_disk_cache_fetch (disk->id, start_sector); + data = grub_disk_cache_fetch (disk->id, start_sector); if (data) { /* Just copy it! */ - pupa_memcpy (buf, data + pos + offset, len); - pupa_disk_cache_unlock (disk->id, start_sector); + grub_memcpy (buf, data + pos + offset, len); + grub_disk_cache_unlock (disk->id, start_sector); } else { /* Otherwise read data from the disk actually. */ if ((disk->dev->read) (disk, start_sector, - PUPA_DISK_CACHE_SIZE, tmp_buf) - != PUPA_ERR_NONE) + GRUB_DISK_CACHE_SIZE, tmp_buf) + != GRUB_ERR_NONE) { /* Uggh... Failed. Instead, just read necessary data. */ unsigned num; - pupa_errno = PUPA_ERR_NONE; + grub_errno = GRUB_ERR_NONE; /* If more data is required, no way. */ if (pos + size - >= (PUPA_DISK_SECTOR_SIZE << PUPA_DISK_CACHE_BITS)) + >= (GRUB_DISK_SECTOR_SIZE << GRUB_DISK_CACHE_BITS)) goto finish; - num = ((size + PUPA_DISK_SECTOR_SIZE - 1) - >> PUPA_DISK_SECTOR_BITS); + num = ((size + GRUB_DISK_SECTOR_SIZE - 1) + >> GRUB_DISK_SECTOR_BITS); if ((disk->dev->read) (disk, sector, num, tmp_buf)) goto finish; - pupa_memcpy (buf, tmp_buf + offset, size); + grub_memcpy (buf, tmp_buf + offset, size); /* Call the read hook, if any. */ if (disk->read_hook) while (size) { (disk->read_hook) (sector, offset, - ((size > PUPA_DISK_SECTOR_SIZE) - ? PUPA_DISK_SECTOR_SIZE + ((size > GRUB_DISK_SECTOR_SIZE) + ? GRUB_DISK_SECTOR_SIZE : size)); sector++; - size -= PUPA_DISK_SECTOR_SIZE - offset; + size -= GRUB_DISK_SECTOR_SIZE - offset; offset = 0; } @@ -403,8 +403,8 @@ pupa_disk_read (pupa_disk_t disk, unsigned long sector, } /* Copy it and store it in the disk cache. */ - pupa_memcpy (buf, tmp_buf + pos + offset, len); - pupa_disk_cache_store (disk->id, start_sector, tmp_buf); + grub_memcpy (buf, tmp_buf + pos + offset, len); + grub_disk_cache_store (disk->id, start_sector, tmp_buf); } /* Call the read hook, if any. */ @@ -416,20 +416,20 @@ pupa_disk_read (pupa_disk_t disk, unsigned long sector, while (l) { (disk->read_hook) (s, offset, - ((l > PUPA_DISK_SECTOR_SIZE) - ? PUPA_DISK_SECTOR_SIZE + ((l > GRUB_DISK_SECTOR_SIZE) + ? GRUB_DISK_SECTOR_SIZE : l)); - if (l < PUPA_DISK_SECTOR_SIZE - offset) + if (l < GRUB_DISK_SECTOR_SIZE - offset) break; s++; - l -= PUPA_DISK_SECTOR_SIZE - offset; + l -= GRUB_DISK_SECTOR_SIZE - offset; offset = 0; } } - sector = start_sector + PUPA_DISK_CACHE_SIZE; + sector = start_sector + GRUB_DISK_CACHE_SIZE; buf += len; size -= len; offset = 0; @@ -437,38 +437,38 @@ pupa_disk_read (pupa_disk_t disk, unsigned long sector, finish: - pupa_free (tmp_buf); + grub_free (tmp_buf); - return pupa_errno; + return grub_errno; } -pupa_err_t -pupa_disk_write (pupa_disk_t disk, unsigned long sector, +grub_err_t +grub_disk_write (grub_disk_t disk, unsigned long sector, unsigned long offset, unsigned long size, const char *buf) { - if (pupa_disk_check_range (disk, §or, &offset, size) != PUPA_ERR_NONE) + if (grub_disk_check_range (disk, §or, &offset, size) != GRUB_ERR_NONE) return -1; while (size) { - if (offset != 0 || (size < PUPA_DISK_SECTOR_SIZE && size != 0)) + if (offset != 0 || (size < GRUB_DISK_SECTOR_SIZE && size != 0)) { - char tmp_buf[PUPA_DISK_SECTOR_SIZE]; + char tmp_buf[GRUB_DISK_SECTOR_SIZE]; unsigned long len; - if (pupa_disk_read (disk, sector, 0, PUPA_DISK_SECTOR_SIZE, tmp_buf) - != PUPA_ERR_NONE) + if (grub_disk_read (disk, sector, 0, GRUB_DISK_SECTOR_SIZE, tmp_buf) + != GRUB_ERR_NONE) goto finish; - len = PUPA_DISK_SECTOR_SIZE - offset; + len = GRUB_DISK_SECTOR_SIZE - offset; if (len > size) len = size; - pupa_memcpy (tmp_buf + offset, buf, len); + grub_memcpy (tmp_buf + offset, buf, len); - pupa_disk_cache_invalidate (disk->id, sector); + grub_disk_cache_invalidate (disk->id, sector); - if ((disk->dev->write) (disk, sector, 1, tmp_buf) != PUPA_ERR_NONE) + if ((disk->dev->write) (disk, sector, 1, tmp_buf) != GRUB_ERR_NONE) goto finish; sector++; @@ -481,14 +481,14 @@ pupa_disk_write (pupa_disk_t disk, unsigned long sector, unsigned long len; unsigned long n; - len = size & ~(PUPA_DISK_SECTOR_SIZE - 1); - n = size >> PUPA_DISK_SECTOR_BITS; + len = size & ~(GRUB_DISK_SECTOR_SIZE - 1); + n = size >> GRUB_DISK_SECTOR_BITS; - if ((disk->dev->write) (disk, sector, n, buf) != PUPA_ERR_NONE) + if ((disk->dev->write) (disk, sector, n, buf) != GRUB_ERR_NONE) goto finish; while (n--) - pupa_disk_cache_invalidate (disk->id, sector++); + grub_disk_cache_invalidate (disk->id, sector++); buf += len; size -= len; @@ -497,46 +497,46 @@ pupa_disk_write (pupa_disk_t disk, unsigned long sector, finish: - return pupa_errno; + return grub_errno; } -pupa_err_t -pupa_print_partinfo (pupa_device_t disk, char *partname) +grub_err_t +grub_print_partinfo (grub_device_t disk, char *partname) { - pupa_fs_t fs = 0; - pupa_device_t part; + grub_fs_t fs = 0; + grub_device_t part; char devname[20]; - pupa_sprintf (devname, "%s,%s", disk->disk->name, partname); - part = pupa_device_open (devname); + grub_sprintf (devname, "%s,%s", disk->disk->name, partname); + part = grub_device_open (devname); if (!part) - pupa_printf ("\tPartition num:%s, Filesystem cannot be accessed", + grub_printf ("\tPartition num:%s, Filesystem cannot be accessed", partname); else { char *label; - fs = pupa_fs_probe (part); + fs = grub_fs_probe (part); /* Ignore all errors. */ - pupa_errno = 0; + grub_errno = 0; - pupa_printf ("\tPartition num:%s, Filesystem type %s", + grub_printf ("\tPartition num:%s, Filesystem type %s", partname, fs ? fs->name : "Unknown"); if (fs) { (fs->label) (part, &label); - if (pupa_errno == PUPA_ERR_NONE) + if (grub_errno == GRUB_ERR_NONE) { - if (label && pupa_strlen (label)) - pupa_printf (", Label: %s", label); - pupa_free (label); + if (label && grub_strlen (label)) + grub_printf (", Label: %s", label); + grub_free (label); } - pupa_errno = PUPA_ERR_NONE; + grub_errno = GRUB_ERR_NONE; } - pupa_device_close (part); + grub_device_close (part); } - pupa_printf ("\n"); - return pupa_errno; + grub_printf ("\n"); + return grub_errno; } diff --git a/kern/dl.c b/kern/dl.c index 860c93dc2..34cc1457c 100644 --- a/kern/dl.c +++ b/kern/dl.c @@ -1,9 +1,9 @@ /* dl.c - loadable module support */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002, 2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,22 +14,22 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#if PUPA_HOST_SIZEOF_VOID_P == 4 +#if GRUB_HOST_SIZEOF_VOID_P == 4 typedef Elf32_Word Elf_Word; typedef Elf32_Addr Elf_Addr; @@ -40,7 +40,7 @@ typedef Elf32_Sym Elf_Sym; # define ELF_ST_BIND(val) ELF32_ST_BIND (val) # define ELF_ST_TYPE(val) ELF32_ST_TYPE (val) -#elif PUPA_HOST_SIZEOF_VOID_P == 8 +#elif GRUB_HOST_SIZEOF_VOID_P == 8 typedef Elf64_Word Elf_Word; typedef Elf64_Addr Elf_Addr; @@ -55,132 +55,132 @@ typedef Elf64_Sym Elf_Sym; -struct pupa_dl_list +struct grub_dl_list { - struct pupa_dl_list *next; - pupa_dl_t mod; + struct grub_dl_list *next; + grub_dl_t mod; }; -typedef struct pupa_dl_list *pupa_dl_list_t; +typedef struct grub_dl_list *grub_dl_list_t; -static pupa_dl_list_t pupa_dl_head; +static grub_dl_list_t grub_dl_head; -static pupa_err_t -pupa_dl_add (pupa_dl_t mod) +static grub_err_t +grub_dl_add (grub_dl_t mod) { - pupa_dl_list_t l; + grub_dl_list_t l; - if (pupa_dl_get (mod->name)) - return pupa_error (PUPA_ERR_BAD_MODULE, + if (grub_dl_get (mod->name)) + return grub_error (GRUB_ERR_BAD_MODULE, "`%s' is already loaded", mod->name); - l = (pupa_dl_list_t) pupa_malloc (sizeof (*l)); + l = (grub_dl_list_t) grub_malloc (sizeof (*l)); if (! l) - return pupa_errno; + return grub_errno; l->mod = mod; - l->next = pupa_dl_head; - pupa_dl_head = l; + l->next = grub_dl_head; + grub_dl_head = l; - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } static void -pupa_dl_remove (pupa_dl_t mod) +grub_dl_remove (grub_dl_t mod) { - pupa_dl_list_t *p, q; + grub_dl_list_t *p, q; - for (p = &pupa_dl_head, q = *p; q; p = &q->next, q = *p) + for (p = &grub_dl_head, q = *p; q; p = &q->next, q = *p) if (q->mod == mod) { *p = q->next; - pupa_free (q); + grub_free (q); return; } } -pupa_dl_t -pupa_dl_get (const char *name) +grub_dl_t +grub_dl_get (const char *name) { - pupa_dl_list_t l; + grub_dl_list_t l; - for (l = pupa_dl_head; l; l = l->next) - if (pupa_strcmp (name, l->mod->name) == 0) + for (l = grub_dl_head; l; l = l->next) + if (grub_strcmp (name, l->mod->name) == 0) return l->mod; return 0; } void -pupa_dl_iterate (int (*hook) (pupa_dl_t mod)) +grub_dl_iterate (int (*hook) (grub_dl_t mod)) { - pupa_dl_list_t l; + grub_dl_list_t l; - for (l = pupa_dl_head; l; l = l->next) + for (l = grub_dl_head; l; l = l->next) if (hook (l->mod)) break; } -struct pupa_symbol +struct grub_symbol { - struct pupa_symbol *next; + struct grub_symbol *next; const char *name; void *addr; - pupa_dl_t mod; /* The module to which this symbol belongs. */ + grub_dl_t mod; /* The module to which this symbol belongs. */ }; -typedef struct pupa_symbol *pupa_symbol_t; +typedef struct grub_symbol *grub_symbol_t; /* The size of the symbol table. */ -#define PUPA_SYMTAB_SIZE 509 +#define GRUB_SYMTAB_SIZE 509 /* The symbol table (using an open-hash). */ -static struct pupa_symbol *pupa_symtab[PUPA_SYMTAB_SIZE]; +static struct grub_symbol *grub_symtab[GRUB_SYMTAB_SIZE]; /* Simple hash function. */ static unsigned -pupa_symbol_hash (const char *s) +grub_symbol_hash (const char *s) { unsigned key = 0; while (*s) key = key * 65599 + *s++; - return (key + (key >> 5)) % PUPA_SYMTAB_SIZE; + return (key + (key >> 5)) % GRUB_SYMTAB_SIZE; } /* Resolve the symbol name NAME and return the address. Return NULL, if not found. */ void * -pupa_dl_resolve_symbol (const char *name) +grub_dl_resolve_symbol (const char *name) { - pupa_symbol_t sym; + grub_symbol_t sym; - for (sym = pupa_symtab[pupa_symbol_hash (name)]; sym; sym = sym->next) - if (pupa_strcmp (sym->name, name) == 0) + for (sym = grub_symtab[grub_symbol_hash (name)]; sym; sym = sym->next) + if (grub_strcmp (sym->name, name) == 0) return sym->addr; return 0; } /* Register a symbol with the name NAME and the address ADDR. */ -pupa_err_t -pupa_dl_register_symbol (const char *name, void *addr, pupa_dl_t mod) +grub_err_t +grub_dl_register_symbol (const char *name, void *addr, grub_dl_t mod) { - pupa_symbol_t sym; + grub_symbol_t sym; unsigned k; - sym = (pupa_symbol_t) pupa_malloc (sizeof (*sym)); + sym = (grub_symbol_t) grub_malloc (sizeof (*sym)); if (! sym) - return pupa_errno; + return grub_errno; if (mod) { - sym->name = pupa_strdup (name); + sym->name = grub_strdup (name); if (! sym->name) { - pupa_free (sym); - return pupa_errno; + grub_free (sym); + return grub_errno; } } else @@ -189,34 +189,34 @@ pupa_dl_register_symbol (const char *name, void *addr, pupa_dl_t mod) sym->addr = addr; sym->mod = mod; - k = pupa_symbol_hash (name); - sym->next = pupa_symtab[k]; - pupa_symtab[k] = sym; + k = grub_symbol_hash (name); + sym->next = grub_symtab[k]; + grub_symtab[k] = sym; - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } /* Unregister all the symbols defined in the module MOD. */ static void -pupa_dl_unregister_symbols (pupa_dl_t mod) +grub_dl_unregister_symbols (grub_dl_t mod) { unsigned i; if (! mod) - pupa_fatal ("core symbols cannot be unregistered"); + grub_fatal ("core symbols cannot be unregistered"); - for (i = 0; i < PUPA_SYMTAB_SIZE; i++) + for (i = 0; i < GRUB_SYMTAB_SIZE; i++) { - pupa_symbol_t sym, *p, q; + grub_symbol_t sym, *p, q; - for (p = &pupa_symtab[i], sym = *p; sym; sym = q) + for (p = &grub_symtab[i], sym = *p; sym; sym = q) { q = sym->next; if (sym->mod == mod) { *p = q; - pupa_free ((void *) sym->name); - pupa_free (sym); + grub_free ((void *) sym->name); + grub_free (sym); } else p = &sym->next; @@ -226,9 +226,9 @@ pupa_dl_unregister_symbols (pupa_dl_t mod) /* Return the address of a section whose index is N. */ static void * -pupa_dl_get_section_addr (pupa_dl_t mod, unsigned n) +grub_dl_get_section_addr (grub_dl_t mod, unsigned n) { - pupa_dl_segment_t seg; + grub_dl_segment_t seg; for (seg = mod->segment; seg; seg = seg->next) if (seg->section == n) @@ -238,8 +238,8 @@ pupa_dl_get_section_addr (pupa_dl_t mod, unsigned n) } /* Load all segments from memory specified by E. */ -static pupa_err_t -pupa_dl_load_segments (pupa_dl_t mod, const Elf_Ehdr *e) +static grub_err_t +grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e) { unsigned i; Elf_Shdr *s; @@ -250,30 +250,30 @@ pupa_dl_load_segments (pupa_dl_t mod, const Elf_Ehdr *e) { if (s->sh_flags & SHF_ALLOC) { - pupa_dl_segment_t seg; + grub_dl_segment_t seg; - seg = (pupa_dl_segment_t) pupa_malloc (sizeof (*seg)); + seg = (grub_dl_segment_t) grub_malloc (sizeof (*seg)); if (! seg) - return pupa_errno; + return grub_errno; if (s->sh_size) { void *addr; - addr = pupa_memalign (s->sh_addralign, s->sh_size); + addr = grub_memalign (s->sh_addralign, s->sh_size); if (! addr) { - pupa_free (seg); - return pupa_errno; + grub_free (seg); + return grub_errno; } switch (s->sh_type) { case SHT_PROGBITS: - pupa_memcpy (addr, (char *) e + s->sh_offset, s->sh_size); + grub_memcpy (addr, (char *) e + s->sh_offset, s->sh_size); break; case SHT_NOBITS: - pupa_memset (addr, 0, s->sh_size); + grub_memset (addr, 0, s->sh_size); break; } @@ -289,11 +289,11 @@ pupa_dl_load_segments (pupa_dl_t mod, const Elf_Ehdr *e) } } - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } -static pupa_err_t -pupa_dl_resolve_symbols (pupa_dl_t mod, Elf_Ehdr *e) +static grub_err_t +grub_dl_resolve_symbols (grub_dl_t mod, Elf_Ehdr *e) { unsigned i; Elf_Shdr *s; @@ -308,7 +308,7 @@ pupa_dl_resolve_symbols (pupa_dl_t mod, Elf_Ehdr *e) break; if (i == e->e_shnum) - return pupa_error (PUPA_ERR_BAD_MODULE, "no symbol table"); + return grub_error (GRUB_ERR_BAD_MODULE, "no symbol table"); sym = (Elf_Sym *) ((char *) e + s->sh_offset); size = s->sh_size; @@ -331,9 +331,9 @@ pupa_dl_resolve_symbols (pupa_dl_t mod, Elf_Ehdr *e) /* Resolve a global symbol. */ if (sym->st_name != 0 && sym->st_shndx == 0) { - sym->st_value = (Elf_Addr) pupa_dl_resolve_symbol (name); + sym->st_value = (Elf_Addr) grub_dl_resolve_symbol (name); if (! sym->st_value) - return pupa_error (PUPA_ERR_BAD_MODULE, + return grub_error (GRUB_ERR_BAD_MODULE, "the symbol `%s' not found", name); } else @@ -341,28 +341,28 @@ pupa_dl_resolve_symbols (pupa_dl_t mod, Elf_Ehdr *e) break; case STT_OBJECT: - sym->st_value += (Elf_Addr) pupa_dl_get_section_addr (mod, + sym->st_value += (Elf_Addr) grub_dl_get_section_addr (mod, sym->st_shndx); if (bind != STB_LOCAL) - if (pupa_dl_register_symbol (name, (void *) sym->st_value, mod)) - return pupa_errno; + if (grub_dl_register_symbol (name, (void *) sym->st_value, mod)) + return grub_errno; break; case STT_FUNC: - sym->st_value += (Elf_Addr) pupa_dl_get_section_addr (mod, + sym->st_value += (Elf_Addr) grub_dl_get_section_addr (mod, sym->st_shndx); if (bind != STB_LOCAL) - if (pupa_dl_register_symbol (name, (void *) sym->st_value, mod)) - return pupa_errno; + if (grub_dl_register_symbol (name, (void *) sym->st_value, mod)) + return grub_errno; - if (pupa_strcmp (name, "pupa_mod_init") == 0) - mod->init = (void (*) (pupa_dl_t)) sym->st_value; - else if (pupa_strcmp (name, "pupa_mod_fini") == 0) + if (grub_strcmp (name, "grub_mod_init") == 0) + mod->init = (void (*) (grub_dl_t)) sym->st_value; + else if (grub_strcmp (name, "grub_mod_fini") == 0) mod->fini = (void (*) (void)) sym->st_value; break; case STT_SECTION: - sym->st_value = (Elf_Addr) pupa_dl_get_section_addr (mod, + sym->st_value = (Elf_Addr) grub_dl_get_section_addr (mod, sym->st_shndx); break; @@ -371,23 +371,23 @@ pupa_dl_resolve_symbols (pupa_dl_t mod, Elf_Ehdr *e) break; default: - return pupa_error (PUPA_ERR_BAD_MODULE, + return grub_error (GRUB_ERR_BAD_MODULE, "unknown symbol type `%d'", (int) type); } } - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } static void -pupa_dl_call_init (pupa_dl_t mod) +grub_dl_call_init (grub_dl_t mod) { if (mod->init) (mod->init) (mod); } -static pupa_err_t -pupa_dl_resolve_name (pupa_dl_t mod, Elf_Ehdr *e) +static grub_err_t +grub_dl_resolve_name (grub_dl_t mod, Elf_Ehdr *e) { Elf_Shdr *s; const char *str; @@ -399,22 +399,22 @@ pupa_dl_resolve_name (pupa_dl_t mod, Elf_Ehdr *e) for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff); i < e->e_shnum; i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize)) - if (pupa_strcmp (str + s->sh_name, ".modname") == 0) + if (grub_strcmp (str + s->sh_name, ".modname") == 0) { - mod->name = pupa_strdup ((char *) e + s->sh_offset); + mod->name = grub_strdup ((char *) e + s->sh_offset); if (! mod->name) - return pupa_errno; + return grub_errno; break; } if (i == e->e_shnum) - return pupa_error (PUPA_ERR_BAD_MODULE, "no module name found"); + return grub_error (GRUB_ERR_BAD_MODULE, "no module name found"); - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } -static pupa_err_t -pupa_dl_resolve_dependencies (pupa_dl_t mod, Elf_Ehdr *e) +static grub_err_t +grub_dl_resolve_dependencies (grub_dl_t mod, Elf_Ehdr *e) { Elf_Shdr *s; const char *str; @@ -426,74 +426,74 @@ pupa_dl_resolve_dependencies (pupa_dl_t mod, Elf_Ehdr *e) for (i = 0, s = (Elf_Shdr *) ((char *) e + e->e_shoff); i < e->e_shnum; i++, s = (Elf_Shdr *) ((char *) s + e->e_shentsize)) - if (pupa_strcmp (str + s->sh_name, ".moddeps") == 0) + if (grub_strcmp (str + s->sh_name, ".moddeps") == 0) { const char *name = (char *) e + s->sh_offset; const char *max = name + s->sh_size; while (name < max) { - pupa_dl_t m; - pupa_dl_dep_t dep; + grub_dl_t m; + grub_dl_dep_t dep; - m = pupa_dl_load (name); + m = grub_dl_load (name); if (! m) - return pupa_errno; + return grub_errno; - pupa_dl_ref (m); + grub_dl_ref (m); - dep = (pupa_dl_dep_t) pupa_malloc (sizeof (*dep)); + dep = (grub_dl_dep_t) grub_malloc (sizeof (*dep)); if (! dep) - return pupa_errno; + return grub_errno; dep->mod = m; dep->next = mod->dep; mod->dep = dep; - name += pupa_strlen (name) + 1; + name += grub_strlen (name) + 1; } } - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } int -pupa_dl_ref (pupa_dl_t mod) +grub_dl_ref (grub_dl_t mod) { - pupa_dl_dep_t dep; + grub_dl_dep_t dep; for (dep = mod->dep; dep; dep = dep->next) - pupa_dl_ref (dep->mod); + grub_dl_ref (dep->mod); return ++mod->ref_count; } int -pupa_dl_unref (pupa_dl_t mod) +grub_dl_unref (grub_dl_t mod) { - pupa_dl_dep_t dep; + grub_dl_dep_t dep; for (dep = mod->dep; dep; dep = dep->next) - pupa_dl_unref (dep->mod); + grub_dl_unref (dep->mod); return --mod->ref_count; } /* Load a module from core memory. */ -pupa_dl_t -pupa_dl_load_core (void *addr, pupa_size_t size) +grub_dl_t +grub_dl_load_core (void *addr, grub_size_t size) { Elf_Ehdr *e; - pupa_dl_t mod; + grub_dl_t mod; e = addr; - if (! pupa_arch_dl_check_header (e, size)) + if (! grub_arch_dl_check_header (e, size)) { - pupa_error (PUPA_ERR_BAD_MODULE, "invalid ELF header"); + grub_error (GRUB_ERR_BAD_MODULE, "invalid ELF header"); return 0; } - mod = (pupa_dl_t) pupa_malloc (sizeof (*mod)); + mod = (grub_dl_t) grub_malloc (sizeof (*mod)); if (! mod) return 0; @@ -504,22 +504,22 @@ pupa_dl_load_core (void *addr, pupa_size_t size) mod->init = 0; mod->fini = 0; - if (pupa_dl_resolve_name (mod, e) - || pupa_dl_resolve_dependencies (mod, e) - || pupa_dl_load_segments (mod, e) - || pupa_dl_resolve_symbols (mod, e) - || pupa_arch_dl_relocate_symbols (mod, e)) + if (grub_dl_resolve_name (mod, e) + || grub_dl_resolve_dependencies (mod, e) + || grub_dl_load_segments (mod, e) + || grub_dl_resolve_symbols (mod, e) + || grub_arch_dl_relocate_symbols (mod, e)) { mod->fini = 0; - pupa_dl_unload (mod); + grub_dl_unload (mod); return 0; } - pupa_dl_call_init (mod); + grub_dl_call_init (mod); - if (pupa_dl_add (mod)) + if (grub_dl_add (mod)) { - pupa_dl_unload (mod); + grub_dl_unload (mod); return 0; } @@ -527,75 +527,75 @@ pupa_dl_load_core (void *addr, pupa_size_t size) } /* Load a module from the file FILENAME. */ -pupa_dl_t -pupa_dl_load_file (const char *filename) +grub_dl_t +grub_dl_load_file (const char *filename) { - pupa_file_t file; - pupa_ssize_t size; + grub_file_t file; + grub_ssize_t size; void *core = 0; - pupa_dl_t mod = 0; + grub_dl_t mod = 0; - file = pupa_file_open (filename); + file = grub_file_open (filename); if (! file) return 0; - size = pupa_file_size (file); - core = pupa_malloc (size); + size = grub_file_size (file); + core = grub_malloc (size); if (! core) goto failed; - if (pupa_file_read (file, core, size) != (int) size) + if (grub_file_read (file, core, size) != (int) size) goto failed; - mod = pupa_dl_load_core (core, size); + mod = grub_dl_load_core (core, size); mod->ref_count = 0; failed: - pupa_file_close (file); - pupa_free (core); + grub_file_close (file); + grub_free (core); return mod; } /* Load a module using a symbolic name. */ -pupa_dl_t -pupa_dl_load (const char *name) +grub_dl_t +grub_dl_load (const char *name) { char *filename; - pupa_dl_t mod; - char *pupa_dl_dir = pupa_env_get ("prefix"); + grub_dl_t mod; + char *grub_dl_dir = grub_env_get ("prefix"); - mod = pupa_dl_get (name); + mod = grub_dl_get (name); if (mod) return mod; - if (! pupa_dl_dir) - pupa_fatal ("module dir is not initialized yet"); + if (! grub_dl_dir) + grub_fatal ("module dir is not initialized yet"); - filename = (char *) pupa_malloc (pupa_strlen (pupa_dl_dir) + 1 - + pupa_strlen (name) + 4 + 1); + filename = (char *) grub_malloc (grub_strlen (grub_dl_dir) + 1 + + grub_strlen (name) + 4 + 1); if (! filename) return 0; - pupa_sprintf (filename, "%s/%s.mod", pupa_dl_dir, name); - mod = pupa_dl_load_file (filename); - pupa_free (filename); + grub_sprintf (filename, "%s/%s.mod", grub_dl_dir, name); + mod = grub_dl_load_file (filename); + grub_free (filename); if (! mod) return 0; - if (pupa_strcmp (mod->name, name) != 0) - pupa_error (PUPA_ERR_BAD_MODULE, "mismatched names"); + if (grub_strcmp (mod->name, name) != 0) + grub_error (GRUB_ERR_BAD_MODULE, "mismatched names"); return mod; } /* Unload the module MOD. */ int -pupa_dl_unload (pupa_dl_t mod) +grub_dl_unload (grub_dl_t mod) { - pupa_dl_dep_t dep, depn; - pupa_dl_segment_t seg, segn; + grub_dl_dep_t dep, depn; + grub_dl_segment_t seg, segn; if (mod->ref_count > 0) return 0; @@ -603,44 +603,44 @@ pupa_dl_unload (pupa_dl_t mod) if (mod->fini) (mod->fini) (); - pupa_dl_remove (mod); - pupa_dl_unregister_symbols (mod); + grub_dl_remove (mod); + grub_dl_unregister_symbols (mod); for (dep = mod->dep; dep; dep = depn) { depn = dep->next; - if (! pupa_dl_unref (dep->mod)) - pupa_dl_unload (dep->mod); + if (! grub_dl_unref (dep->mod)) + grub_dl_unload (dep->mod); - pupa_free (dep); + grub_free (dep); } for (seg = mod->segment; seg; seg = segn) { segn = seg->next; - pupa_free (seg->addr); - pupa_free (seg); + grub_free (seg->addr); + grub_free (seg); } - pupa_free (mod->name); - pupa_free (mod); + grub_free (mod->name); + grub_free (mod); return 1; } /* Unload unneeded modules. */ void -pupa_dl_unload_unneeded (void) +grub_dl_unload_unneeded (void) { - /* Because pupa_dl_remove modifies the list of modules, this + /* Because grub_dl_remove modifies the list of modules, this implementation is tricky. */ - pupa_dl_list_t p = pupa_dl_head; + grub_dl_list_t p = grub_dl_head; while (p) { - if (pupa_dl_unload (p->mod)) + if (grub_dl_unload (p->mod)) { - p = pupa_dl_head; + p = grub_dl_head; continue; } @@ -650,17 +650,17 @@ pupa_dl_unload_unneeded (void) /* Unload all modules. */ void -pupa_dl_unload_all (void) +grub_dl_unload_all (void) { - while (pupa_dl_head) + while (grub_dl_head) { - pupa_dl_list_t p; + grub_dl_list_t p; - pupa_dl_unload_unneeded (); + grub_dl_unload_unneeded (); /* Force to decrement the ref count. This will purge pre-loaded modules and manually inserted modules. */ - for (p = pupa_dl_head; p; p = p->next) + for (p = grub_dl_head; p; p = p->next) p->mod->ref_count--; } } diff --git a/kern/env.c b/kern/env.c index 5d667f2fc..1bb258168 100644 --- a/kern/env.c +++ b/kern/env.c @@ -1,9 +1,9 @@ /* env.c - Environment variables */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,25 +14,25 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include +#include +#include +#include /* XXX: What would be a good size for the hashtable? */ #define HASHSZ 123 /* A hashtable for quick lookup of variables. */ -static struct pupa_env_var *pupa_env[HASHSZ]; +static struct grub_env_var *grub_env[HASHSZ]; /* The variables in a sorted list. */ -static struct pupa_env_var *pupa_env_sorted; +static struct grub_env_var *grub_env_sorted; /* Return the hash representation of the string S. */ -static unsigned int pupa_env_hashval (const char *s) +static unsigned int grub_env_hashval (const char *s) { unsigned int i = 0; @@ -43,73 +43,73 @@ static unsigned int pupa_env_hashval (const char *s) return i % HASHSZ; } -static struct pupa_env_var * -pupa_env_find (const char *name) +static struct grub_env_var * +grub_env_find (const char *name) { - struct pupa_env_var *var; - int idx = pupa_env_hashval (name); + struct grub_env_var *var; + int idx = grub_env_hashval (name); - for (var = pupa_env[idx]; var; var = var->next) - if (! pupa_strcmp (var->name, name)) + for (var = grub_env[idx]; var; var = var->next) + if (! grub_strcmp (var->name, name)) return var; return 0; } -pupa_err_t -pupa_env_set (const char *var, const char *val) +grub_err_t +grub_env_set (const char *var, const char *val) { - int idx = pupa_env_hashval (var); - struct pupa_env_var *env; - struct pupa_env_var *sort; - struct pupa_env_var **sortp; + int idx = grub_env_hashval (var); + struct grub_env_var *env; + struct grub_env_var *sort; + struct grub_env_var **sortp; /* If the variable does already exist, just update the variable. */ - env = pupa_env_find (var); + env = grub_env_find (var); if (env) { char *old = env->value; - env->value = pupa_strdup (val); + env->value = grub_strdup (val); if (! env->name) { env->value = old; - return pupa_errno; + return grub_errno; } if (env->write_hook) (env->write_hook) (env); - pupa_free (old); + grub_free (old); return 0; } /* The variable does not exist, create it. */ - env = pupa_malloc (sizeof (struct pupa_env_var)); + env = grub_malloc (sizeof (struct grub_env_var)); if (! env) - return pupa_errno; + return grub_errno; - pupa_memset (env, 0, sizeof (struct pupa_env_var)); + grub_memset (env, 0, sizeof (struct grub_env_var)); - env->name = pupa_strdup (var); + env->name = grub_strdup (var); if (! env->name) goto fail; - env->value = pupa_strdup (val); + env->value = grub_strdup (val); if (! env->name) goto fail; /* Insert it in the hashtable. */ - env->prevp = &pupa_env[idx]; - env->next = pupa_env[idx]; - if (pupa_env[idx]) - pupa_env[idx]->prevp = &env->next; - pupa_env[idx] = env; + env->prevp = &grub_env[idx]; + env->next = grub_env[idx]; + if (grub_env[idx]) + grub_env[idx]->prevp = &env->next; + grub_env[idx] = env; /* Insert it in the sorted list. */ - sortp = &pupa_env_sorted; - sort = pupa_env_sorted; + sortp = &grub_env_sorted; + sort = grub_env_sorted; while (sort) { - if (pupa_strcmp (sort->name, var) > 0) + if (grub_strcmp (sort->name, var) > 0) break; sortp = &sort->sort_next; @@ -122,21 +122,21 @@ pupa_env_set (const char *var, const char *val) *sortp = env; fail: - if (pupa_errno) + if (grub_errno) { - pupa_free (env->name); - pupa_free (env->value); - pupa_free (env); + grub_free (env->name); + grub_free (env->value); + grub_free (env); } return 0; } char * -pupa_env_get (const char *name) +grub_env_get (const char *name) { - struct pupa_env_var *env; - env = pupa_env_find (name); + struct grub_env_var *env; + env = grub_env_find (name); if (! env) return 0; @@ -152,10 +152,10 @@ pupa_env_get (const char *name) } void -pupa_env_unset (const char *name) +grub_env_unset (const char *name) { - struct pupa_env_var *env; - env = pupa_env_find (name); + struct grub_env_var *env; + env = grub_env_find (name); if (! env) return; @@ -172,38 +172,38 @@ pupa_env_unset (const char *name) if (env->sort_next) env->sort_next->sort_prevp = env->sort_prevp; - pupa_free (env->name); - pupa_free (env->value); - pupa_free (env); + grub_free (env->name); + grub_free (env->value); + grub_free (env); return; } void -pupa_env_iterate (int (* func) (struct pupa_env_var *var)) +grub_env_iterate (int (* func) (struct grub_env_var *var)) { - struct pupa_env_var *env; + struct grub_env_var *env; - for (env = pupa_env_sorted; env; env = env->sort_next) + for (env = grub_env_sorted; env; env = env->sort_next) if (func (env)) return; } -pupa_err_t -pupa_register_variable_hook (const char *var, - pupa_err_t (*read_hook) (struct pupa_env_var *var, char **), - pupa_err_t (*write_hook) (struct pupa_env_var *var)) +grub_err_t +grub_register_variable_hook (const char *var, + grub_err_t (*read_hook) (struct grub_env_var *var, char **), + grub_err_t (*write_hook) (struct grub_env_var *var)) { - struct pupa_env_var *env = pupa_env_find (var); + struct grub_env_var *env = grub_env_find (var); if (! env) - if (pupa_env_set (var, "") != PUPA_ERR_NONE) - return pupa_errno; + if (grub_env_set (var, "") != GRUB_ERR_NONE) + return grub_errno; - env = pupa_env_find (var); + env = grub_env_find (var); /* XXX Insert an assertion? */ env->read_hook = read_hook; env->write_hook = write_hook; - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } diff --git a/kern/err.c b/kern/err.c index 5f724d2bc..df0df26e5 100644 --- a/kern/err.c +++ b/kern/err.c @@ -1,9 +1,9 @@ /* err.c - error handling routines */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,48 +14,48 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include +#include +#include #include -#define PUPA_MAX_ERRMSG 256 +#define GRUB_MAX_ERRMSG 256 -pupa_err_t pupa_errno; -char pupa_errmsg[PUPA_MAX_ERRMSG]; +grub_err_t grub_errno; +char grub_errmsg[GRUB_MAX_ERRMSG]; -pupa_err_t -pupa_error (pupa_err_t n, const char *fmt, ...) +grub_err_t +grub_error (grub_err_t n, const char *fmt, ...) { va_list ap; - pupa_errno = n; + grub_errno = n; va_start (ap, fmt); - pupa_vsprintf (pupa_errmsg, fmt, ap); + grub_vsprintf (grub_errmsg, fmt, ap); va_end (ap); return n; } void -pupa_fatal (const char *fmt, ...) +grub_fatal (const char *fmt, ...) { va_list ap; va_start (ap, fmt); - pupa_vprintf (fmt, ap); + grub_vprintf (fmt, ap); va_end (ap); - pupa_stop (); + grub_stop (); } void -pupa_print_error (void) +grub_print_error (void) { - if (pupa_errno != PUPA_ERR_NONE) - pupa_printf ("error: %s\n", pupa_errmsg); + if (grub_errno != GRUB_ERR_NONE) + grub_printf ("error: %s\n", grub_errmsg); } diff --git a/kern/file.c b/kern/file.c index dbd4f058e..029cd6475 100644 --- a/kern/file.c +++ b/kern/file.c @@ -1,9 +1,9 @@ /* file.c - file I/O functions */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,37 +14,37 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include /* Get the device part of the filename NAME. It is enclosed by parentheses. */ char * -pupa_file_get_device_name (const char *name) +grub_file_get_device_name (const char *name) { if (name[0] == '(') { - char *p = pupa_strchr (name, ')'); + char *p = grub_strchr (name, ')'); char *ret; if (! p) { - pupa_error (PUPA_ERR_BAD_FILENAME, "missing `)'"); + grub_error (GRUB_ERR_BAD_FILENAME, "missing `)'"); return 0; } - ret = (char *) pupa_malloc (p - name); + ret = (char *) grub_malloc (p - name); if (! ret) return 0; - pupa_memcpy (ret, name + 1, p - name - 1); + grub_memcpy (ret, name + 1, p - name - 1); ret[p - name - 1] = '\0'; return ret; } @@ -52,31 +52,31 @@ pupa_file_get_device_name (const char *name) return 0; } -pupa_file_t -pupa_file_open (const char *name) +grub_file_t +grub_file_open (const char *name) { - pupa_device_t device; - pupa_file_t file = 0; + grub_device_t device; + grub_file_t file = 0; char *device_name; char *file_name; - device_name = pupa_file_get_device_name (name); - if (pupa_errno) + device_name = grub_file_get_device_name (name); + if (grub_errno) return 0; /* Get the file part of NAME. */ - file_name = pupa_strchr (name, ')'); + file_name = grub_strchr (name, ')'); if (file_name) file_name++; else file_name = (char *) name; - device = pupa_device_open (device_name); - pupa_free (device_name); + device = grub_device_open (device_name); + grub_free (device_name); if (! device) goto fail; - file = (pupa_file_t) pupa_malloc (sizeof (*file)); + file = (grub_file_t) grub_malloc (sizeof (*file)); if (! file) goto fail; @@ -87,34 +87,34 @@ pupa_file_open (const char *name) if (device->disk && file_name[0] != '/') /* This is a block list. */ - file->fs = &pupa_fs_blocklist; + file->fs = &grub_fs_blocklist; else { - file->fs = pupa_fs_probe (device); + file->fs = grub_fs_probe (device); if (! file->fs) goto fail; } - if ((file->fs->open) (file, file_name) != PUPA_ERR_NONE) + if ((file->fs->open) (file, file_name) != GRUB_ERR_NONE) goto fail; return file; fail: if (device) - pupa_device_close (device); + grub_device_close (device); - /* if (net) pupa_net_close (net); */ + /* if (net) grub_net_close (net); */ - pupa_free (file); + grub_free (file); return 0; } -pupa_ssize_t -pupa_file_read (pupa_file_t file, char *buf, pupa_ssize_t len) +grub_ssize_t +grub_file_read (grub_file_t file, char *buf, grub_ssize_t len) { - pupa_ssize_t res; + grub_ssize_t res; if (len == 0 || len > file->size - file->offset) len = file->size - file->offset; @@ -129,25 +129,25 @@ pupa_file_read (pupa_file_t file, char *buf, pupa_ssize_t len) return res; } -pupa_err_t -pupa_file_close (pupa_file_t file) +grub_err_t +grub_file_close (grub_file_t file) { if (file->fs->close) (file->fs->close) (file); - pupa_device_close (file->device); - pupa_free (file); - return pupa_errno; + grub_device_close (file->device); + grub_free (file); + return grub_errno; } -pupa_ssize_t -pupa_file_seek (pupa_file_t file, pupa_ssize_t offset) +grub_ssize_t +grub_file_seek (grub_file_t file, grub_ssize_t offset) { - pupa_ssize_t old; + grub_ssize_t old; if (offset < 0 || offset >= file->size) { - pupa_error (PUPA_ERR_OUT_OF_RANGE, + grub_error (GRUB_ERR_OUT_OF_RANGE, "attempt to seek outside of the file"); return -1; } diff --git a/kern/fs.c b/kern/fs.c index 4de85b4eb..5967953f5 100644 --- a/kern/fs.c +++ b/kern/fs.c @@ -1,9 +1,9 @@ /* fs.c - filesystem manager */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,35 +14,35 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -static pupa_fs_t pupa_fs_list; +static grub_fs_t grub_fs_list; void -pupa_fs_register (pupa_fs_t fs) +grub_fs_register (grub_fs_t fs) { - fs->next = pupa_fs_list; - pupa_fs_list = fs; + fs->next = grub_fs_list; + grub_fs_list = fs; } void -pupa_fs_unregister (pupa_fs_t fs) +grub_fs_unregister (grub_fs_t fs) { - pupa_fs_t *p, q; + grub_fs_t *p, q; - for (p = &pupa_fs_list, q = *p; q; p = &(q->next), q = q->next) + for (p = &grub_fs_list, q = *p; q; p = &(q->next), q = q->next) if (q == fs) { *p = q->next; @@ -51,19 +51,19 @@ pupa_fs_unregister (pupa_fs_t fs) } void -pupa_fs_iterate (int (*hook) (const pupa_fs_t fs)) +grub_fs_iterate (int (*hook) (const grub_fs_t fs)) { - pupa_fs_t p; + grub_fs_t p; - for (p = pupa_fs_list; p; p = p->next) + for (p = grub_fs_list; p; p = p->next) if (hook (p)) break; } -pupa_fs_t -pupa_fs_probe (pupa_device_t device) +grub_fs_t +grub_fs_probe (grub_device_t device) { - pupa_fs_t p; + grub_fs_t p; auto int dummy_func (const char *filename, int dir); int dummy_func (const char *filename __attribute__ ((unused)), @@ -74,22 +74,22 @@ pupa_fs_probe (pupa_device_t device) if (device->disk) { - for (p = pupa_fs_list; p; p = p->next) + for (p = grub_fs_list; p; p = p->next) { (p->dir) (device, "/", dummy_func); - if (pupa_errno == PUPA_ERR_NONE) + if (grub_errno == GRUB_ERR_NONE) return p; - if (pupa_errno != PUPA_ERR_BAD_FS) + if (grub_errno != GRUB_ERR_BAD_FS) return 0; - pupa_errno = PUPA_ERR_NONE; + grub_errno = GRUB_ERR_NONE; } } else if (device->net->fs) return device->net->fs; - pupa_error (PUPA_ERR_UNKNOWN_FS, "unknown filesystem"); + grub_error (GRUB_ERR_UNKNOWN_FS, "unknown filesystem"); return 0; } @@ -97,31 +97,31 @@ pupa_fs_probe (pupa_device_t device) /* Block list support routines. */ -struct pupa_fs_block +struct grub_fs_block { unsigned long offset; unsigned long length; }; -static pupa_err_t -pupa_fs_blocklist_open (pupa_file_t file, const char *name) +static grub_err_t +grub_fs_blocklist_open (grub_file_t file, const char *name) { char *p = (char *) name; unsigned num = 0; unsigned i; - pupa_disk_t disk = file->device->disk; - struct pupa_fs_block *blocks; + grub_disk_t disk = file->device->disk; + struct grub_fs_block *blocks; /* First, count the number of blocks. */ do { num++; - p = pupa_strchr (p, ','); + p = grub_strchr (p, ','); } while (p); /* Allocate a block list. */ - blocks = pupa_malloc (sizeof (struct pupa_fs_block) * (num + 1)); + blocks = grub_malloc (sizeof (struct grub_fs_block) * (num + 1)); if (! blocks) return 0; @@ -131,10 +131,10 @@ pupa_fs_blocklist_open (pupa_file_t file, const char *name) { if (*p != '+') { - blocks[i].offset = pupa_strtoul (p, &p, 0); - if (pupa_errno != PUPA_ERR_NONE || *p != '+') + blocks[i].offset = grub_strtoul (p, &p, 0); + if (grub_errno != GRUB_ERR_NONE || *p != '+') { - pupa_error (PUPA_ERR_BAD_FILENAME, + grub_error (GRUB_ERR_BAD_FILENAME, "invalid file name `%s'", name); goto fail; } @@ -143,68 +143,68 @@ pupa_fs_blocklist_open (pupa_file_t file, const char *name) blocks[i].offset = 0; p++; - blocks[i].length = pupa_strtoul (p, &p, 0); - if (pupa_errno != PUPA_ERR_NONE + blocks[i].length = grub_strtoul (p, &p, 0); + if (grub_errno != GRUB_ERR_NONE || blocks[i].length == 0 - || (*p && *p != ',' && ! pupa_isspace (*p))) + || (*p && *p != ',' && ! grub_isspace (*p))) { - pupa_error (PUPA_ERR_BAD_FILENAME, + grub_error (GRUB_ERR_BAD_FILENAME, "invalid file name `%s'", name); goto fail; } if (disk->total_sectors < blocks[i].offset + blocks[i].length) { - pupa_error (PUPA_ERR_BAD_FILENAME, "beyond the total sectors"); + grub_error (GRUB_ERR_BAD_FILENAME, "beyond the total sectors"); goto fail; } - file->size += (blocks[i].length << PUPA_DISK_SECTOR_BITS); + file->size += (blocks[i].length << GRUB_DISK_SECTOR_BITS); p++; } blocks[i].length = 0; file->data = blocks; - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; fail: - pupa_free (blocks); - return pupa_errno; + grub_free (blocks); + return grub_errno; } -static pupa_ssize_t -pupa_fs_blocklist_read (pupa_file_t file, char *buf, pupa_ssize_t len) +static grub_ssize_t +grub_fs_blocklist_read (grub_file_t file, char *buf, grub_ssize_t len) { - struct pupa_fs_block *p; + struct grub_fs_block *p; unsigned long sector; unsigned long offset; - pupa_ssize_t ret = 0; + grub_ssize_t ret = 0; if (len > file->size - file->offset) len = file->size - file->offset; - sector = (file->offset >> PUPA_DISK_SECTOR_BITS); - offset = (file->offset & (PUPA_DISK_SECTOR_SIZE - 1)); + sector = (file->offset >> GRUB_DISK_SECTOR_BITS); + offset = (file->offset & (GRUB_DISK_SECTOR_SIZE - 1)); for (p = file->data; p->length && len > 0; p++) { if (sector < p->length) { - pupa_ssize_t size; + grub_ssize_t size; size = len; - if (((size + offset + PUPA_DISK_SECTOR_SIZE - 1) - >> PUPA_DISK_SECTOR_BITS) > p->length - sector) - size = ((p->length - sector) << PUPA_DISK_SECTOR_BITS) - offset; + if (((size + offset + GRUB_DISK_SECTOR_SIZE - 1) + >> GRUB_DISK_SECTOR_BITS) > p->length - sector) + size = ((p->length - sector) << GRUB_DISK_SECTOR_BITS) - offset; - if (pupa_disk_read (file->device->disk, p->offset + sector, offset, - size, buf) != PUPA_ERR_NONE) + if (grub_disk_read (file->device->disk, p->offset + sector, offset, + size, buf) != GRUB_ERR_NONE) return -1; ret += size; len -= size; - sector -= ((size + offset) >> PUPA_DISK_SECTOR_BITS); - offset = ((size + offset) & (PUPA_DISK_SECTOR_SIZE - 1)); + sector -= ((size + offset) >> GRUB_DISK_SECTOR_BITS); + offset = ((size + offset) & (GRUB_DISK_SECTOR_SIZE - 1)); } else sector -= p->length; @@ -213,12 +213,12 @@ pupa_fs_blocklist_read (pupa_file_t file, char *buf, pupa_ssize_t len) return ret; } -struct pupa_fs pupa_fs_blocklist = +struct grub_fs grub_fs_blocklist = { .name = "blocklist", .dir = 0, - .open = pupa_fs_blocklist_open, - .read = pupa_fs_blocklist_read, + .open = grub_fs_blocklist_open, + .read = grub_fs_blocklist_read, .close = 0, .next = 0 }; diff --git a/kern/i386/dl.c b/kern/i386/dl.c index abc125e52..49a5114d2 100644 --- a/kern/i386/dl.c +++ b/kern/i386/dl.c @@ -1,9 +1,9 @@ /* dl-386.c - arch-dependent part of loadable module support */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,18 +14,18 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include +#include +#include +#include +#include /* Check if EHDR is a valid ELF header. */ int -pupa_arch_dl_check_header (void *ehdr, unsigned size) +grub_arch_dl_check_header (void *ehdr, unsigned size) { Elf32_Ehdr *e = ehdr; @@ -53,8 +53,8 @@ pupa_arch_dl_check_header (void *ehdr, unsigned size) } /* Relocate symbols. */ -pupa_err_t -pupa_arch_dl_relocate_symbols (pupa_dl_t mod, void *ehdr) +grub_err_t +grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) { Elf32_Ehdr *e = ehdr; Elf32_Shdr *s; @@ -70,7 +70,7 @@ pupa_arch_dl_relocate_symbols (pupa_dl_t mod, void *ehdr) break; if (i == e->e_shnum) - return pupa_error (PUPA_ERR_BAD_MODULE, "no symtab found"); + return grub_error (GRUB_ERR_BAD_MODULE, "no symtab found"); symtab = (Elf32_Sym *) ((char *) e + s->sh_offset); entsize = s->sh_entsize; @@ -80,7 +80,7 @@ pupa_arch_dl_relocate_symbols (pupa_dl_t mod, void *ehdr) i++, s = (Elf32_Shdr *) ((char *) s + e->e_shentsize)) if (s->sh_type == SHT_REL) { - pupa_dl_segment_t seg; + grub_dl_segment_t seg; /* Find the target segment. */ for (seg = mod->segment; seg; seg = seg->next) @@ -100,7 +100,7 @@ pupa_arch_dl_relocate_symbols (pupa_dl_t mod, void *ehdr) Elf32_Sym *sym; if (seg->size < rel->r_offset) - return pupa_error (PUPA_ERR_BAD_MODULE, + return grub_error (GRUB_ERR_BAD_MODULE, "reloc offset is out of the segment"); addr = (Elf32_Word *) ((char *) seg->addr + rel->r_offset); @@ -122,5 +122,5 @@ pupa_arch_dl_relocate_symbols (pupa_dl_t mod, void *ehdr) } } - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } diff --git a/kern/i386/pc/init.c b/kern/i386/pc/init.c index 3ddec9203..871aa14a5 100644 --- a/kern/i386/pc/init.c +++ b/kern/i386/pc/init.c @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002, 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,24 +17,24 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include struct mem_region { - pupa_addr_t addr; - pupa_size_t size; + grub_addr_t addr; + grub_size_t size; }; #define MAX_REGIONS 32 @@ -42,9 +42,9 @@ struct mem_region static struct mem_region mem_regions[MAX_REGIONS]; static int num_regions; -pupa_addr_t pupa_os_area_addr; -pupa_size_t pupa_os_area_size; -pupa_size_t pupa_lower_mem, pupa_upper_mem; +grub_addr_t grub_os_area_addr; +grub_size_t grub_os_area_size; +grub_size_t grub_lower_mem, grub_upper_mem; static char * make_install_device (void) @@ -52,25 +52,25 @@ make_install_device (void) /* XXX: This should be enough. */ char dev[100]; - pupa_sprintf (dev, "(%cd%u", - (pupa_boot_drive & 0x80) ? 'h' : 'f', - pupa_boot_drive & 0x7f); + grub_sprintf (dev, "(%cd%u", + (grub_boot_drive & 0x80) ? 'h' : 'f', + grub_boot_drive & 0x7f); - if (pupa_install_dos_part >= 0) - pupa_sprintf (dev + pupa_strlen (dev), ",%u", pupa_install_dos_part); + if (grub_install_dos_part >= 0) + grub_sprintf (dev + grub_strlen (dev), ",%u", grub_install_dos_part); - if (pupa_install_bsd_part >= 0) - pupa_sprintf (dev + pupa_strlen (dev), ",%c", pupa_install_bsd_part + 'a'); + if (grub_install_bsd_part >= 0) + grub_sprintf (dev + grub_strlen (dev), ",%c", grub_install_bsd_part + 'a'); - pupa_sprintf (dev + pupa_strlen (dev), ")%s", pupa_prefix); - pupa_strcpy (pupa_prefix, dev); + grub_sprintf (dev + grub_strlen (dev), ")%s", grub_prefix); + grub_strcpy (grub_prefix, dev); - return pupa_prefix; + return grub_prefix; } /* Add a memory region. */ static void -add_mem_region (pupa_addr_t addr, pupa_size_t size) +add_mem_region (grub_addr_t addr, grub_size_t size) { if (num_regions == MAX_REGIONS) /* Ignore. */ @@ -108,44 +108,44 @@ compact_mem_regions (void) mem_regions[i].size = (mem_regions[j].addr + mem_regions[j].size - mem_regions[i].addr); - pupa_memmove (mem_regions + j, mem_regions + j + 1, + grub_memmove (mem_regions + j, mem_regions + j + 1, (num_regions - j - 1) * sizeof (struct mem_region)); i--; } } void -pupa_machine_init (void) +grub_machine_init (void) { - pupa_uint32_t cont; - struct pupa_machine_mmap_entry *entry - = (struct pupa_machine_mmap_entry *) PUPA_MEMORY_MACHINE_SCRATCH_ADDR; - pupa_addr_t end_addr = pupa_get_end_addr (); + grub_uint32_t cont; + struct grub_machine_mmap_entry *entry + = (struct grub_machine_mmap_entry *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR; + grub_addr_t end_addr = grub_get_end_addr (); int i; /* Initialize the console as early as possible. */ - pupa_console_init (); + grub_console_init (); - pupa_lower_mem = pupa_get_memsize (0) << 10; + grub_lower_mem = grub_get_memsize (0) << 10; /* Sanity check. */ - if (pupa_lower_mem < PUPA_MEMORY_MACHINE_RESERVED_END) - pupa_fatal ("too small memory"); + if (grub_lower_mem < GRUB_MEMORY_MACHINE_RESERVED_END) + grub_fatal ("too small memory"); #if 0 /* Turn on Gate A20 to access >1MB. */ - pupa_gate_a20 (1); + grub_gate_a20 (1); #endif /* Add the lower memory into free memory. */ - if (pupa_lower_mem >= PUPA_MEMORY_MACHINE_RESERVED_END) - add_mem_region (PUPA_MEMORY_MACHINE_RESERVED_END, - pupa_lower_mem - PUPA_MEMORY_MACHINE_RESERVED_END); + if (grub_lower_mem >= GRUB_MEMORY_MACHINE_RESERVED_END) + add_mem_region (GRUB_MEMORY_MACHINE_RESERVED_END, + grub_lower_mem - GRUB_MEMORY_MACHINE_RESERVED_END); - add_mem_region (end_addr, PUPA_MEMORY_MACHINE_RESERVED_START - end_addr); + add_mem_region (end_addr, GRUB_MEMORY_MACHINE_RESERVED_START - end_addr); - /* Check if pupa_get_mmap_entry works. */ - cont = pupa_get_mmap_entry (entry, 0); + /* Check if grub_get_mmap_entry works. */ + cont = grub_get_mmap_entry (entry, 0); if (entry->size) do @@ -163,13 +163,13 @@ pupa_machine_init (void) /* Ignore >4GB. */ if (entry->addr <= 0xFFFFFFFF && entry->type == 1) { - pupa_addr_t addr; - pupa_size_t len; + grub_addr_t addr; + grub_size_t len; - addr = (pupa_addr_t) entry->addr; + addr = (grub_addr_t) entry->addr; len = ((addr + entry->len > 0xFFFFFFFF) ? 0xFFFFFFFF - addr - : (pupa_size_t) entry->len); + : (grub_size_t) entry->len); add_mem_region (addr, len); } @@ -177,12 +177,12 @@ pupa_machine_init (void) if (! cont) break; - cont = pupa_get_mmap_entry (entry, cont); + cont = grub_get_mmap_entry (entry, cont); } while (entry->size); else { - pupa_uint32_t eisa_mmap = pupa_get_eisa_mmap (); + grub_uint32_t eisa_mmap = grub_get_eisa_mmap (); if (eisa_mmap) { @@ -195,7 +195,7 @@ pupa_machine_init (void) } } else - add_mem_region (0x100000, pupa_get_memsize (1) << 10); + add_mem_region (0x100000, grub_get_memsize (1) << 10); } compact_mem_regions (); @@ -206,24 +206,24 @@ pupa_machine_init (void) for (i = 0; i < num_regions; i++) if (mem_regions[i].addr == 0x100000) { - pupa_size_t quarter = mem_regions[i].size >> 2; + grub_size_t quarter = mem_regions[i].size >> 2; - pupa_upper_mem = mem_regions[i].size; - pupa_os_area_addr = mem_regions[i].addr; - pupa_os_area_size = mem_regions[i].size - quarter; - pupa_mm_init_region ((void *) (pupa_os_area_addr + pupa_os_area_size), + grub_upper_mem = mem_regions[i].size; + grub_os_area_addr = mem_regions[i].addr; + grub_os_area_size = mem_regions[i].size - quarter; + grub_mm_init_region ((void *) (grub_os_area_addr + grub_os_area_size), quarter); } else - pupa_mm_init_region ((void *) mem_regions[i].addr, mem_regions[i].size); + grub_mm_init_region ((void *) mem_regions[i].addr, mem_regions[i].size); - if (! pupa_os_area_addr) - pupa_fatal ("no upper memory"); + if (! grub_os_area_addr) + grub_fatal ("no upper memory"); /* The memory system was initialized, thus register built-in devices. */ - pupa_biosdisk_init (); + grub_biosdisk_init (); /* Initialize the prefix. */ - pupa_env_set ("prefix", make_install_device ()); + grub_env_set ("prefix", make_install_device ()); } diff --git a/kern/i386/pc/lzo1x.S b/kern/i386/pc/lzo1x.S index 567a100a6..0fe7b86d8 100644 --- a/kern/i386/pc/lzo1x.S +++ b/kern/i386/pc/lzo1x.S @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 1996-2002 Markus Franz Xaver Johannes Oberhumer * Copyright (C) 2003 Free Software Foundation, Inc. * @@ -21,7 +21,7 @@ /* * This code was stolen from the files enter.sh, leave.sh, lzo1x_d.sh, * lzo1x_f.s and lzo_asm.h in LZO version 1.08, and was heavily modified - * to adapt it to PUPA's requirement. + * to adapt it to GRUB's requirement. * * See , for more information * about LZO. diff --git a/kern/i386/pc/startup.S b/kern/i386/pc/startup.S index 903caf273..b84320f97 100644 --- a/kern/i386/pc/startup.S +++ b/kern/i386/pc/startup.S @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 1999,2000,2001,2002,2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -35,7 +35,7 @@ */ /* - * Note: PUPA is compiled with the options -mrtd and -mregparm=3. + * Note: GRUB is compiled with the options -mrtd and -mregparm=3. * So the first three arguments are passed in %eax, %edx, and %ecx, * respectively, and if a function has a fixed number of arguments * and the number if greater than three, the function must return @@ -43,16 +43,16 @@ */ #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include -#define ABS(x) ((x) - EXT_C(start) + PUPA_BOOT_MACHINE_KERNEL_ADDR + 0x200) +#define ABS(x) ((x) - EXT_C(start) + GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200) .file "startup.S" @@ -77,7 +77,7 @@ _start: * DO NOT MOVE !!! */ . = EXT_C(start) + 0x6 - .byte PUPA_BOOT_VERSION_MAJOR, PUPA_BOOT_VERSION_MINOR + .byte GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR /* * This is a special data area 8 bytes from the beginning. @@ -85,18 +85,18 @@ _start: . = EXT_C(start) + 0x8 -VARIABLE(pupa_total_module_size) +VARIABLE(grub_total_module_size) .long 0 -VARIABLE(pupa_kernel_image_size) +VARIABLE(grub_kernel_image_size) .long 0 -VARIABLE(pupa_compressed_size) +VARIABLE(grub_compressed_size) .long 0 -VARIABLE(pupa_install_dos_part) +VARIABLE(grub_install_dos_part) .long 0xFFFFFFFF -VARIABLE(pupa_install_bsd_part) +VARIABLE(grub_install_bsd_part) .long 0xFFFFFFFF -VARIABLE(pupa_prefix) - .string "/boot/pupa" +VARIABLE(grub_prefix) + .string "/boot/grub" /* * Leave some breathing room for the prefix. @@ -115,13 +115,13 @@ codestart: movw %ax, %es /* set up the real mode/BIOS stack */ - movl $PUPA_MEMORY_MACHINE_REAL_STACK, %ebp + movl $GRUB_MEMORY_MACHINE_REAL_STACK, %ebp movl %ebp, %esp sti /* we're safe again */ /* save boot drive reference */ - ADDR32 movb %dl, EXT_C(pupa_boot_drive) + ADDR32 movb %dl, EXT_C(grub_boot_drive) /* reset disk system (%ah = 0) */ int $0x13 @@ -133,14 +133,14 @@ codestart: .code32 incl %eax - call EXT_C(pupa_gate_a20) + call EXT_C(grub_gate_a20) /* decompress the compressed part and put the result at 1MB */ movl $0x100000, %esi - movl $(START_SYMBOL + PUPA_KERNEL_MACHINE_RAW_SIZE), %edi + movl $(START_SYMBOL + GRUB_KERNEL_MACHINE_RAW_SIZE), %edi pushl %esi - pushl EXT_C(pupa_compressed_size) + pushl EXT_C(grub_compressed_size) pushl %edi call lzo1x_decompress addl $12, %esp @@ -152,8 +152,8 @@ codestart: movsb /* copy modules before cleaning out the bss */ - movl EXT_C(pupa_total_module_size), %ecx - movl EXT_C(pupa_kernel_image_size), %esi + movl EXT_C(grub_total_module_size), %ecx + movl EXT_C(grub_kernel_image_size), %esi addl %ecx, %esi addl $START_SYMBOL, %esi decl %esi @@ -180,7 +180,7 @@ codestart: /* * Call the start of main body of C code. */ - call EXT_C(pupa_main) + call EXT_C(grub_main) /* @@ -190,18 +190,18 @@ codestart: .p2align 2 /* force 4-byte alignment */ protstack: - .long PUPA_MEMORY_MACHINE_PROT_STACK + .long GRUB_MEMORY_MACHINE_PROT_STACK -VARIABLE(pupa_boot_drive) +VARIABLE(grub_boot_drive) .long 0 -VARIABLE(pupa_start_addr) +VARIABLE(grub_start_addr) .long START_SYMBOL -VARIABLE(pupa_end_addr) +VARIABLE(grub_end_addr) .long END_SYMBOL -VARIABLE(pupa_apm_bios_info) +VARIABLE(grub_apm_bios_info) .word 0 /* version */ .word 0 /* cseg */ .long 0 /* offset */ @@ -275,16 +275,16 @@ real_to_prot: /* turn on protected mode */ movl %cr0, %eax - orl $PUPA_MEMORY_MACHINE_CR0_PE_ON, %eax + orl $GRUB_MEMORY_MACHINE_CR0_PE_ON, %eax movl %eax, %cr0 /* jump to relocation, flush prefetch queue, and reload %cs */ - DATA32 ljmp $PUPA_MEMORY_MACHINE_PROT_MODE_CSEG, $protcseg + DATA32 ljmp $GRUB_MEMORY_MACHINE_PROT_MODE_CSEG, $protcseg .code32 protcseg: /* reload other segment registers */ - movw $PUPA_MEMORY_MACHINE_PROT_MODE_DSEG, %ax + movw $GRUB_MEMORY_MACHINE_PROT_MODE_DSEG, %ax movw %ax, %ds movw %ax, %es movw %ax, %fs @@ -293,7 +293,7 @@ protcseg: /* put the return address in a known safe location */ movl (%esp), %eax - movl %eax, PUPA_MEMORY_MACHINE_REAL_STACK + movl %eax, GRUB_MEMORY_MACHINE_REAL_STACK /* get protected mode stack */ movl protstack, %eax @@ -301,7 +301,7 @@ protcseg: movl %eax, %ebp /* get return address onto the right stack */ - movl PUPA_MEMORY_MACHINE_REAL_STACK, %eax + movl GRUB_MEMORY_MACHINE_REAL_STACK, %eax movl %eax, (%esp) /* zero %eax */ @@ -321,15 +321,15 @@ prot_to_real: /* get the return address */ movl (%esp), %eax - movl %eax, PUPA_MEMORY_MACHINE_REAL_STACK + movl %eax, GRUB_MEMORY_MACHINE_REAL_STACK /* set up new stack */ - movl $PUPA_MEMORY_MACHINE_REAL_STACK, %eax + movl $GRUB_MEMORY_MACHINE_REAL_STACK, %eax movl %eax, %esp movl %eax, %ebp /* set up segment limits */ - movw $PUPA_MEMORY_MACHINE_PSEUDO_REAL_DSEG, %ax + movw $GRUB_MEMORY_MACHINE_PSEUDO_REAL_DSEG, %ax movw %ax, %ds movw %ax, %es movw %ax, %fs @@ -338,14 +338,14 @@ prot_to_real: /* this might be an extra step */ /* jump to a 16 bit segment */ - ljmp $PUPA_MEMORY_MACHINE_PSEUDO_REAL_CSEG, $tmpcseg + ljmp $GRUB_MEMORY_MACHINE_PSEUDO_REAL_CSEG, $tmpcseg tmpcseg: .code16 /* clear the PE bit of CR0 */ movl %cr0, %eax - andl $(~PUPA_MEMORY_MACHINE_CR0_PE_ON), %eax + andl $(~GRUB_MEMORY_MACHINE_CR0_PE_ON), %eax movl %eax, %cr0 /* flush prefetch queue, reload %cs */ @@ -374,7 +374,7 @@ realcseg: /* - * pupa_gate_a20(int on) + * grub_gate_a20(int on) * * Gate address-line 20 for high memory. * @@ -383,7 +383,7 @@ realcseg: * It also eats any keystrokes in the keyboard buffer. :-( */ -FUNCTION(pupa_gate_a20) +FUNCTION(grub_gate_a20) movl %eax, %ecx call gloop1 @@ -437,7 +437,7 @@ gloop2ret: * hang at this point! */ -FUNCTION(pupa_stop) +FUNCTION(grub_stop) call prot_to_real /* @@ -446,29 +446,29 @@ FUNCTION(pupa_stop) * mode, so think about it before changing it. */ -FUNCTION(pupa_hard_stop) +FUNCTION(grub_hard_stop) hlt - jmp EXT_C(pupa_hard_stop) + jmp EXT_C(grub_hard_stop) /* - * pupa_stop_floppy() + * grub_stop_floppy() * * Stop the floppy drive from spinning, so that other software is * jumped to with a known state. */ -FUNCTION(pupa_stop_floppy) +FUNCTION(grub_stop_floppy) movw $0x3F2, %dx xorb %al, %al outb %al, %dx ret /* - * pupa_reboot() + * grub_reboot() * * Reboot the system. At the moment, rely on BIOS. */ -FUNCTION(pupa_reboot) +FUNCTION(grub_reboot) call prot_to_real .code16 /* cold boot */ @@ -478,15 +478,15 @@ FUNCTION(pupa_reboot) .code32 /* - * pupa_halt(int no_apm) + * grub_halt(int no_apm) * * Halt the system, using APM if possible. If NO_APM is true, don't use * APM even if it is available. */ -FUNCTION(pupa_halt) +FUNCTION(grub_halt) /* see if zero */ testl %eax, %eax - jnz EXT_C(pupa_stop) + jnz EXT_C(grub_stop) call prot_to_real .code16 @@ -495,7 +495,7 @@ FUNCTION(pupa_halt) movw $0x5300, %ax xorw %bx, %bx int $0x15 - jc EXT_C(pupa_hard_stop) + jc EXT_C(grub_hard_stop) /* don't check %bx for buggy BIOSes... */ /* disconnect APM first */ @@ -507,14 +507,14 @@ FUNCTION(pupa_halt) movw $0x5301, %ax xorw %bx, %bx int $0x15 - jc EXT_C(pupa_hard_stop) + jc EXT_C(grub_hard_stop) /* set APM protocol level - 1.1 or bust. (this covers APM 1.2 also) */ movw $0x530E, %ax xorw %bx, %bx movw $0x0101, %cx int $0x15 - jc EXT_C(pupa_hard_stop) + jc EXT_C(grub_hard_stop) /* set the power state to off */ movw $0x5307, %ax @@ -523,21 +523,21 @@ FUNCTION(pupa_halt) int $0x15 /* shouldn't reach here */ - jmp EXT_C(pupa_hard_stop) + jmp EXT_C(grub_hard_stop) .code32 /* - * void pupa_chainloader_real_boot (int drive, void *part_addr) + * void grub_chainloader_real_boot (int drive, void *part_addr) * * This starts another boot loader. */ -FUNCTION(pupa_chainloader_real_boot) +FUNCTION(grub_chainloader_real_boot) pushl %edx pushl %eax - call EXT_C(pupa_dl_unload_all) + call EXT_C(grub_dl_unload_all) /* set up to pass boot drive */ popl %edx @@ -547,44 +547,44 @@ FUNCTION(pupa_chainloader_real_boot) /* Turn off Gate A20 */ xorl %eax, %eax - call EXT_C(pupa_gate_a20) + call EXT_C(grub_gate_a20) call prot_to_real .code16 - ljmp $0, $PUPA_MEMORY_MACHINE_BOOT_LOADER_ADDR + ljmp $0, $GRUB_MEMORY_MACHINE_BOOT_LOADER_ADDR .code32 /* - * void pupa_linux_boot_zimage (void) + * void grub_linux_boot_zimage (void) */ -VARIABLE(pupa_linux_prot_size) +VARIABLE(grub_linux_prot_size) .long 0 -VARIABLE(pupa_linux_tmp_addr) +VARIABLE(grub_linux_tmp_addr) .long 0 -VARIABLE(pupa_linux_real_addr) +VARIABLE(grub_linux_real_addr) .long 0 -FUNCTION(pupa_linux_boot_zimage) +FUNCTION(grub_linux_boot_zimage) /* copy the kernel */ - movl EXT_C(pupa_linux_prot_size), %ecx + movl EXT_C(grub_linux_prot_size), %ecx addl $3, %ecx shrl $2, %ecx - movl $PUPA_LINUX_BZIMAGE_ADDR, %esi - movl $PUPA_LINUX_ZIMAGE_ADDR, %edi + movl $GRUB_LINUX_BZIMAGE_ADDR, %esi + movl $GRUB_LINUX_ZIMAGE_ADDR, %edi cld rep movsl -FUNCTION(pupa_linux_boot_bzimage) - call EXT_C(pupa_dl_unload_all) +FUNCTION(grub_linux_boot_bzimage) + call EXT_C(grub_dl_unload_all) - movl EXT_C(pupa_linux_real_addr), %ebx + movl EXT_C(grub_linux_real_addr), %ebx /* copy the real mode code */ - movl EXT_C(pupa_linux_tmp_addr), %esi + movl EXT_C(grub_linux_tmp_addr), %esi movl %ebx, %edi - movl $PUPA_LINUX_SETUP_MOVE_SIZE, %ecx + movl $GRUB_LINUX_SETUP_MOVE_SIZE, %ecx cld rep movsb @@ -597,7 +597,7 @@ FUNCTION(pupa_linux_boot_bzimage) /* XXX new stack pointer in safe area for calling functions */ movl $0x4000, %esp - call EXT_C(pupa_stop_floppy) + call EXT_C(grub_stop_floppy) /* final setup for linux boot */ call prot_to_real @@ -605,7 +605,7 @@ FUNCTION(pupa_linux_boot_bzimage) cli movw %bx, %ss - movw $PUPA_LINUX_SETUP_STACK, %sp + movw $GRUB_LINUX_SETUP_STACK, %sp movw %bx, %ds movw %bx, %es @@ -624,34 +624,34 @@ linux_setup_seg: * This starts the multiboot kernel. */ -FUNCTION(pupa_multiboot_real_boot) +FUNCTION(grub_multiboot_real_boot) /* Push the entry address on the stack. */ pushl %eax /* Move the address of the multiboot information structure to ebx. */ movl %edx,%ebx /* Unload all modules and stop the floppy driver. */ - call EXT_C(pupa_dl_unload_all) - call EXT_C(pupa_stop_floppy) + call EXT_C(grub_dl_unload_all) + call EXT_C(grub_stop_floppy) /* Interrupts should be disabled. */ cli /* Move the magic value into eax and jump to the kernel. */ - movl $PUPA_MB_MAGIC2,%eax + movl $GRUB_MB_MAGIC2,%eax popl %ecx jmp *%ecx /* - * int pupa_biosdisk_rw_int13_extensions (int ah, int drive, void *dap) + * int grub_biosdisk_rw_int13_extensions (int ah, int drive, void *dap) * * Call IBM/MS INT13 Extensions (int 13 %ah=AH) for DRIVE. DAP * is passed for disk address packet. If an error occurs, return * non-zero, otherwise zero. */ -FUNCTION(pupa_biosdisk_rw_int13_extensions) +FUNCTION(grub_biosdisk_rw_int13_extensions) pushl %ebp pushl %esi @@ -685,7 +685,7 @@ FUNCTION(pupa_biosdisk_rw_int13_extensions) ret /* - * int pupa_biosdisk_rw_standard (int ah, int drive, int coff, int hoff, + * int grub_biosdisk_rw_standard (int ah, int drive, int coff, int hoff, * int soff, int nsec, int segment) * * Call standard and old INT13 (int 13 %ah=AH) for DRIVE. Read/write @@ -693,7 +693,7 @@ FUNCTION(pupa_biosdisk_rw_int13_extensions) * return non-zero, otherwise zero. */ -FUNCTION(pupa_biosdisk_rw_standard) +FUNCTION(grub_biosdisk_rw_standard) pushl %ebp movl %esp, %ebp @@ -759,13 +759,13 @@ FUNCTION(pupa_biosdisk_rw_standard) /* - * int pupa_biosdisk_check_int13_extensions (int drive) + * int grub_biosdisk_check_int13_extensions (int drive) * * Check if LBA is supported for DRIVE. If it is supported, then return * the major version of extensions, otherwise zero. */ -FUNCTION(pupa_biosdisk_check_int13_extensions) +FUNCTION(grub_biosdisk_check_int13_extensions) pushl %ebp pushl %ebx @@ -806,13 +806,13 @@ FUNCTION(pupa_biosdisk_check_int13_extensions) /* - * int pupa_biosdisk_get_diskinfo_int13_extensions (int drive, void *drp) + * int grub_biosdisk_get_diskinfo_int13_extensions (int drive, void *drp) * * Return the geometry of DRIVE in a drive parameters, DRP. If an error * occurs, then return non-zero, otherwise zero. */ -FUNCTION(pupa_biosdisk_get_diskinfo_int13_extensions) +FUNCTION(grub_biosdisk_get_diskinfo_int13_extensions) pushl %ebp pushl %ebx pushl %esi @@ -849,7 +849,7 @@ FUNCTION(pupa_biosdisk_get_diskinfo_int13_extensions) /* - * int pupa_biosdisk_get_diskinfo_standard (int drive, + * int grub_biosdisk_get_diskinfo_standard (int drive, * unsigned long *cylinders, * unsigned long *heads, * unsigned long *sectors) @@ -858,7 +858,7 @@ FUNCTION(pupa_biosdisk_get_diskinfo_int13_extensions) * error occurs, then return non-zero, otherwise zero. */ -FUNCTION(pupa_biosdisk_get_diskinfo_standard) +FUNCTION(grub_biosdisk_get_diskinfo_standard) pushl %ebp pushl %ebx pushl %edi @@ -922,9 +922,9 @@ FUNCTION(pupa_biosdisk_get_diskinfo_standard) /* - * int pupa_biosdisk_get_num_floppies (void) + * int grub_biosdisk_get_num_floppies (void) */ -FUNCTION(pupa_biosdisk_get_num_floppies) +FUNCTION(grub_biosdisk_get_num_floppies) pushl %ebp xorl %edx, %edx @@ -960,7 +960,7 @@ FUNCTION(pupa_biosdisk_get_num_floppies) /* * - * pupa_get_memsize(i) : return the memory size in KB. i == 0 for conventional + * grub_get_memsize(i) : return the memory size in KB. i == 0 for conventional * memory, i == 1 for extended memory * BIOS call "INT 12H" to get conventional memory size * BIOS call "INT 15H, AH=88H" to get extended memory size @@ -968,7 +968,7 @@ FUNCTION(pupa_biosdisk_get_num_floppies) * */ -FUNCTION(pupa_get_memsize) +FUNCTION(grub_get_memsize) pushl %ebp movl %eax, %edx @@ -1000,7 +1000,7 @@ xdone: /* * - * pupa_get_eisa_mmap() : return packed EISA memory map, lower 16 bits is + * grub_get_eisa_mmap() : return packed EISA memory map, lower 16 bits is * memory between 1M and 16M in 1K parts, upper 16 bits is * memory above 16M in 64K parts. If error, return zero. * BIOS call "INT 15H, AH=E801H" to get EISA memory map, @@ -1009,7 +1009,7 @@ xdone: * */ -FUNCTION(pupa_get_eisa_mmap) +FUNCTION(grub_get_eisa_mmap) pushl %ebp pushl %ebx @@ -1037,7 +1037,7 @@ xnoteisa: /* * - * pupa_get_mmap_entry(addr, cont) : address and old continuation value (zero to + * grub_get_mmap_entry(addr, cont) : address and old continuation value (zero to * start), for the Query System Address Map BIOS call. * * Sets the first 4-byte int value of "addr" to the size returned by @@ -1046,7 +1046,7 @@ xnoteisa: * Returns: new (non-zero) continuation value, 0 if done. */ -FUNCTION(pupa_get_mmap_entry) +FUNCTION(grub_get_mmap_entry) pushl %ebp pushl %ebx pushl %edi @@ -1113,7 +1113,7 @@ xsmap: /* - * void pupa_console_real_putchar (int c) + * void grub_console_real_putchar (int c) * * Put the character C on the console. Because GRUB wants to write a * character with an attribute, this implementation is a bit tricky. @@ -1126,10 +1126,10 @@ xsmap: * get the height of the screen, and the TELETYPE OUPUT BIOS call doesn't * support setting a background attribute. */ -FUNCTION(pupa_console_real_putchar) +FUNCTION(grub_console_real_putchar) movl %eax, %edx pusha - movb EXT_C(pupa_console_cur_color), %bl + movb EXT_C(grub_console_cur_color), %bl call prot_to_real .code16 @@ -1197,7 +1197,7 @@ FUNCTION(pupa_console_real_putchar) /* - * int pupa_console_getkey (void) + * int grub_console_getkey (void) * BIOS call "INT 16H Function 00H" to read character from keyboard * Call with %ah = 0x0 * Return: %ah = keyboard scan code @@ -1206,16 +1206,16 @@ FUNCTION(pupa_console_real_putchar) /* this table is used in translate_keycode below */ translation_table: - .word PUPA_CONSOLE_KEY_LEFT, 2 - .word PUPA_CONSOLE_KEY_RIGHT, 6 - .word PUPA_CONSOLE_KEY_UP, 16 - .word PUPA_CONSOLE_KEY_DOWN, 14 - .word PUPA_CONSOLE_KEY_HOME, 1 - .word PUPA_CONSOLE_KEY_END, 5 - .word PUPA_CONSOLE_KEY_DC, 4 - .word PUPA_CONSOLE_KEY_BACKSPACE, 8 - .word PUPA_CONSOLE_KEY_PPAGE, 7 - .word PUPA_CONSOLE_KEY_NPAGE, 3 + .word GRUB_CONSOLE_KEY_LEFT, 2 + .word GRUB_CONSOLE_KEY_RIGHT, 6 + .word GRUB_CONSOLE_KEY_UP, 16 + .word GRUB_CONSOLE_KEY_DOWN, 14 + .word GRUB_CONSOLE_KEY_HOME, 1 + .word GRUB_CONSOLE_KEY_END, 5 + .word GRUB_CONSOLE_KEY_DC, 4 + .word GRUB_CONSOLE_KEY_BACKSPACE, 8 + .word GRUB_CONSOLE_KEY_PPAGE, 7 + .word GRUB_CONSOLE_KEY_NPAGE, 3 .word 0 /* @@ -1248,7 +1248,7 @@ translate_keycode: .code32 -FUNCTION(pupa_console_getkey) +FUNCTION(grub_console_getkey) pushl %ebp call prot_to_real @@ -1269,7 +1269,7 @@ FUNCTION(pupa_console_getkey) /* - * int pupa_console_checkkey (void) + * int grub_console_checkkey (void) * if there is a character pending, return it; otherwise return -1 * BIOS call "INT 16H Function 01H" to check whether a character is pending * Call with %ah = 0x1 @@ -1281,7 +1281,7 @@ FUNCTION(pupa_console_getkey) * else * Zero flag = set */ -FUNCTION(pupa_console_checkkey) +FUNCTION(grub_console_checkkey) pushl %ebp xorl %edx, %edx @@ -1310,7 +1310,7 @@ pending: /* - * pupa_uint16_t pupa_console_getxy (void) + * grub_uint16_t grub_console_getxy (void) * BIOS call "INT 10H Function 03h" to get cursor position * Call with %ah = 0x03 * %bh = page @@ -1321,7 +1321,7 @@ pending: */ -FUNCTION(pupa_console_getxy) +FUNCTION(grub_console_getxy) pushl %ebp pushl %ebx /* save EBX */ @@ -1344,7 +1344,7 @@ FUNCTION(pupa_console_getxy) /* - * void pupa_console_gotoxy(pupa_uint8_t x, pupa_uint8_t y) + * void grub_console_gotoxy(grub_uint8_t x, grub_uint8_t y) * BIOS call "INT 10H Function 02h" to set cursor position * Call with %ah = 0x02 * %bh = page @@ -1353,7 +1353,7 @@ FUNCTION(pupa_console_getxy) */ -FUNCTION(pupa_console_gotoxy) +FUNCTION(grub_console_gotoxy) pushl %ebp pushl %ebx /* save EBX */ @@ -1376,7 +1376,7 @@ FUNCTION(pupa_console_gotoxy) /* - * void pupa_console_cls (void) + * void grub_console_cls (void) * BIOS call "INT 10H Function 09h" to write character and attribute * Call with %ah = 0x09 * %al = (character) @@ -1385,7 +1385,7 @@ FUNCTION(pupa_console_gotoxy) * %cx = (number of times) */ -FUNCTION(pupa_console_cls) +FUNCTION(grub_console_cls) pushl %ebp pushl %ebx /* save EBX */ @@ -1417,7 +1417,7 @@ FUNCTION(pupa_console_cls) /* - * void pupa_console_setcursor (int on) + * void grub_console_setcursor (int on) * BIOS call "INT 10H Function 01h" to set cursor type * Call with %ah = 0x01 * %ch = cursor starting scanline @@ -1429,7 +1429,7 @@ console_cursor_state: console_cursor_shape: .word 0 -FUNCTION(pupa_console_setcursor) +FUNCTION(grub_console_setcursor) pushl %ebp pushl %ebx @@ -1474,7 +1474,7 @@ FUNCTION(pupa_console_setcursor) ret /* - * pupa_getrtsecs() + * grub_getrtsecs() * if a seconds value can be read, read it and return it (BCD), * otherwise return 0xFF * BIOS call "INT 1AH Function 02H" to check whether a character is pending @@ -1491,7 +1491,7 @@ FUNCTION(pupa_console_setcursor) * (this indicates that the clock is updating, or * that it isn't running) */ -FUNCTION(pupa_getrtsecs) +FUNCTION(grub_getrtsecs) pushl %ebp call prot_to_real /* enter real mode */ @@ -1515,11 +1515,11 @@ gottime: /* - * pupa_get_rtc() + * grub_get_rtc() * return the real time in ticks, of which there are about * 18-20 per second */ -FUNCTION(pupa_get_rtc) +FUNCTION(grub_get_rtc) pushl %ebp call prot_to_real /* enter real mode */ @@ -1540,9 +1540,9 @@ FUNCTION(pupa_get_rtc) /* - * unsigned char pupa_vga_set_mode (unsigned char mode) + * unsigned char grub_vga_set_mode (unsigned char mode) */ -FUNCTION(pupa_vga_set_mode) +FUNCTION(grub_vga_set_mode) pushl %ebp pushl %ebx movl %eax, %ecx @@ -1570,9 +1570,9 @@ FUNCTION(pupa_vga_set_mode) /* - * unsigned char *pupa_vga_get_font (void) + * unsigned char *grub_vga_get_font (void) */ -FUNCTION(pupa_vga_get_font) +FUNCTION(grub_vga_get_font) pushl %ebp pushl %ebx diff --git a/kern/loader.c b/kern/loader.c index 1e24d2fa3..ea7c774a1 100644 --- a/kern/loader.c +++ b/kern/loader.c @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,51 +13,51 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include +#include +#include +#include +#include -static pupa_err_t (*pupa_loader_boot_func) (void); -static pupa_err_t (*pupa_loader_unload_func) (void); +static grub_err_t (*grub_loader_boot_func) (void); +static grub_err_t (*grub_loader_unload_func) (void); -static int pupa_loader_loaded; +static int grub_loader_loaded; void -pupa_loader_set (pupa_err_t (*boot) (void), - pupa_err_t (*unload) (void)) +grub_loader_set (grub_err_t (*boot) (void), + grub_err_t (*unload) (void)) { - if (pupa_loader_loaded && pupa_loader_unload_func) - pupa_loader_unload_func (); + if (grub_loader_loaded && grub_loader_unload_func) + grub_loader_unload_func (); - pupa_loader_boot_func = boot; - pupa_loader_unload_func = unload; + grub_loader_boot_func = boot; + grub_loader_unload_func = unload; - pupa_loader_loaded = 1; + grub_loader_loaded = 1; } void -pupa_loader_unset(void) +grub_loader_unset(void) { - if (pupa_loader_loaded && pupa_loader_unload_func) - pupa_loader_unload_func (); + if (grub_loader_loaded && grub_loader_unload_func) + grub_loader_unload_func (); - pupa_loader_boot_func = 0; - pupa_loader_unload_func = 0; + grub_loader_boot_func = 0; + grub_loader_unload_func = 0; - pupa_loader_loaded = 0; + grub_loader_loaded = 0; } -pupa_err_t -pupa_loader_boot (void) +grub_err_t +grub_loader_boot (void) { - if (! pupa_loader_loaded) - return pupa_error (PUPA_ERR_NO_KERNEL, "no loaded kernel"); + if (! grub_loader_loaded) + return grub_error (GRUB_ERR_NO_KERNEL, "no loaded kernel"); - return (pupa_loader_boot_func) (); + return (grub_loader_boot_func) (); } diff --git a/kern/main.c b/kern/main.c index 4ff5cf03f..1ea44282f 100644 --- a/kern/main.c +++ b/kern/main.c @@ -1,6 +1,6 @@ /* main.c - the kernel main routine */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002, 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,104 +18,104 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* Return the end of the core image. */ -pupa_addr_t -pupa_get_end_addr (void) +grub_addr_t +grub_get_end_addr (void) { - return pupa_total_module_size + pupa_end_addr; + return grub_total_module_size + grub_end_addr; } /* Load all modules in core. */ static void -pupa_load_modules (void) +grub_load_modules (void) { - struct pupa_module_header *header; + struct grub_module_header *header; - for (header = (struct pupa_module_header *) pupa_end_addr; - header < (struct pupa_module_header *) pupa_get_end_addr (); - header = (struct pupa_module_header *) ((char *) header + header->size)) + for (header = (struct grub_module_header *) grub_end_addr; + header < (struct grub_module_header *) grub_get_end_addr (); + header = (struct grub_module_header *) ((char *) header + header->size)) { - if (! pupa_dl_load_core ((char *) header + header->offset, + if (! grub_dl_load_core ((char *) header + header->offset, (header->size - header->offset))) - pupa_fatal ("%s", pupa_errmsg); + grub_fatal ("%s", grub_errmsg); } } /* Add the region where modules reside into dynamic memory. */ static void -pupa_add_unused_region (void) +grub_add_unused_region (void) { - if (pupa_total_module_size) - pupa_mm_init_region ((void *) pupa_end_addr, pupa_total_module_size); + if (grub_total_module_size) + grub_mm_init_region ((void *) grub_end_addr, grub_total_module_size); } /* Set the root device according to the dl prefix. */ static void -pupa_set_root_dev (void) +grub_set_root_dev (void) { const char *prefix; - prefix = pupa_env_get ("prefix"); + prefix = grub_env_get ("prefix"); if (prefix) { char *dev; - dev = pupa_file_get_device_name (prefix); + dev = grub_file_get_device_name (prefix); if (dev) { - pupa_device_set_root (dev); - pupa_free (dev); + grub_device_set_root (dev); + grub_free (dev); } } } /* Load the normal mode module and execute the normal mode if possible. */ static void -pupa_load_normal_mode (void) +grub_load_normal_mode (void) { /* Load the module. */ - pupa_dl_load ("normal"); + grub_dl_load ("normal"); /* Ignore any error, because we have the rescue mode anyway. */ - pupa_errno = PUPA_ERR_NONE; + grub_errno = GRUB_ERR_NONE; } /* The main routine. */ void -pupa_main (void) +grub_main (void) { /* First of all, initialize the machine. */ - pupa_machine_init (); + grub_machine_init (); /* Hello. */ - pupa_setcolorstate (PUPA_TERM_COLOR_HIGHLIGHT); - pupa_printf ("Welcome to PUPA!\n\n"); - pupa_setcolorstate (PUPA_TERM_COLOR_STANDARD); + grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); + grub_printf ("Welcome to GRUB!\n\n"); + grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); /* It is better to set the root device as soon as possible, for convenience. */ - pupa_set_root_dev (); + grub_set_root_dev (); /* Load pre-loaded modules and free the space. */ - pupa_register_exported_symbols (); - pupa_load_modules (); - pupa_add_unused_region (); + grub_register_exported_symbols (); + grub_load_modules (); + grub_add_unused_region (); /* Load the normal mode module. */ - pupa_load_normal_mode (); + grub_load_normal_mode (); /* Enter the rescue mode. */ - pupa_enter_rescue_mode (); + grub_enter_rescue_mode (); } diff --git a/kern/misc.c b/kern/misc.c index 3e5c2b509..8fe9913a3 100644 --- a/kern/misc.c +++ b/kern/misc.c @@ -1,9 +1,9 @@ /* misc.c - definitions of misc functions */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,19 +14,19 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include +#include +#include +#include #include -#include -#include +#include +#include void * -pupa_memmove (void *dest, const void *src, pupa_size_t n) +grub_memmove (void *dest, const void *src, grub_size_t n) { char *d = (char *) dest; const char *s = (const char *) src; @@ -46,11 +46,11 @@ pupa_memmove (void *dest, const void *src, pupa_size_t n) return dest; } /* GCC emits references to memcpy() for struct copies etc. */ -void *memcpy (void *dest, const void *src, pupa_size_t n) - __attribute__ ((alias ("pupa_memmove"))); +void *memcpy (void *dest, const void *src, grub_size_t n) + __attribute__ ((alias ("grub_memmove"))); char * -pupa_strcpy (char *dest, const char *src) +grub_strcpy (char *dest, const char *src) { char *p = dest; @@ -61,7 +61,7 @@ pupa_strcpy (char *dest, const char *src) } char * -pupa_strncpy (char *dest, const char *src, int c) +grub_strncpy (char *dest, const char *src, int c) { char *p = dest; int pos = 0; @@ -73,7 +73,7 @@ pupa_strncpy (char *dest, const char *src, int c) } char * -pupa_stpcpy (char *dest, const char *src) +grub_stpcpy (char *dest, const char *src) { char *d = dest; const char *s = src; @@ -86,7 +86,7 @@ pupa_stpcpy (char *dest, const char *src) } char * -pupa_strcat (char *dest, const char *src) +grub_strcat (char *dest, const char *src) { char *p = dest; @@ -100,26 +100,26 @@ pupa_strcat (char *dest, const char *src) } int -pupa_printf (const char *fmt, ...) +grub_printf (const char *fmt, ...) { va_list ap; int ret; va_start (ap, fmt); - ret = pupa_vprintf (fmt, ap); + ret = grub_vprintf (fmt, ap); va_end (ap); return ret; } int -pupa_vprintf (const char *fmt, va_list args) +grub_vprintf (const char *fmt, va_list args) { - return pupa_vsprintf (0, fmt, args); + return grub_vsprintf (0, fmt, args); } int -pupa_memcmp (const void *s1, const void *s2, pupa_size_t n) +grub_memcmp (const void *s1, const void *s2, grub_size_t n) { const char *t1 = s1; const char *t2 = s2; @@ -137,7 +137,7 @@ pupa_memcmp (const void *s1, const void *s2, pupa_size_t n) } int -pupa_strcmp (const char *s1, const char *s2) +grub_strcmp (const char *s1, const char *s2) { while (*s1 && *s2) { @@ -152,7 +152,7 @@ pupa_strcmp (const char *s1, const char *s2) } int -pupa_strncmp (const char *s1, const char *s2, int c) +grub_strncmp (const char *s1, const char *s2, int c) { int p = 1; @@ -170,7 +170,7 @@ pupa_strncmp (const char *s1, const char *s2, int c) } char * -pupa_strchr (const char *s, int c) +grub_strchr (const char *s, int c) { while (*s) { @@ -183,7 +183,7 @@ pupa_strchr (const char *s, int c) } char * -pupa_strrchr (const char *s, int c) +grub_strrchr (const char *s, int c) { char *p = 0; @@ -198,37 +198,37 @@ pupa_strrchr (const char *s, int c) } int -pupa_isspace (int c) +grub_isspace (int c) { return (c == '\n' || c == '\r' || c == ' ' || c == '\t'); } int -pupa_isprint (int c) +grub_isprint (int c) { return (c >= ' ' && c <= '~'); } int -pupa_isalpha (int c) +grub_isalpha (int c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); } int -pupa_isdigit (int c) +grub_isdigit (int c) { return (c >= '0' && c <= '9'); } int -pupa_isgraph (int c) +grub_isgraph (int c) { return (c >= '!' && c <= '~'); } int -pupa_tolower (int c) +grub_tolower (int c) { if (c >= 'A' && c <= 'Z') return c - 'A' + 'a'; @@ -237,13 +237,13 @@ pupa_tolower (int c) } unsigned long -pupa_strtoul (const char *str, char **end, int base) +grub_strtoul (const char *str, char **end, int base) { unsigned long num = 0; int found = 0; /* Skip white spaces. */ - while (*str && pupa_isspace (*str)) + while (*str && grub_isspace (*str)) str++; /* Guess the base, if not specified. The prefix `0x' means 16, and @@ -269,7 +269,7 @@ pupa_strtoul (const char *str, char **end, int base) { unsigned long digit; - digit = pupa_tolower (*str) - '0'; + digit = grub_tolower (*str) - '0'; if (digit > 9) { digit += '0' - 'a' + 10; @@ -281,7 +281,7 @@ pupa_strtoul (const char *str, char **end, int base) if (num > (~0UL - digit) / base) { - pupa_error (PUPA_ERR_OUT_OF_RANGE, "overflow is detected"); + grub_error (GRUB_ERR_OUT_OF_RANGE, "overflow is detected"); return 0; } @@ -291,7 +291,7 @@ pupa_strtoul (const char *str, char **end, int base) if (! found) { - pupa_error (PUPA_ERR_BAD_NUMBER, "unrecognized number"); + grub_error (GRUB_ERR_BAD_NUMBER, "unrecognized number"); return 0; } @@ -302,38 +302,38 @@ pupa_strtoul (const char *str, char **end, int base) } char * -pupa_strdup (const char *s) +grub_strdup (const char *s) { - pupa_size_t len; + grub_size_t len; char *p; - len = pupa_strlen (s) + 1; - p = (char *) pupa_malloc (len); + len = grub_strlen (s) + 1; + p = (char *) grub_malloc (len); if (! p) return 0; - return pupa_memcpy (p, s, len); + return grub_memcpy (p, s, len); } char * -pupa_strndup (const char *s, pupa_size_t n) +grub_strndup (const char *s, grub_size_t n) { - pupa_size_t len = 0; + grub_size_t len = 0; char *p = (char *) s; while (*(p++) && len < n) len++; - len = pupa_strlen (s) + 1; - p = (char *) pupa_malloc (len); + len = grub_strlen (s) + 1; + p = (char *) grub_malloc (len); if (! p) return 0; - return pupa_memcpy (p, s, len); + return grub_memcpy (p, s, len); } void * -pupa_memset (void *s, int c, pupa_size_t n) +grub_memset (void *s, int c, grub_size_t n) { unsigned char *p = (unsigned char *) s; @@ -343,8 +343,8 @@ pupa_memset (void *s, int c, pupa_size_t n) return s; } -pupa_size_t -pupa_strlen (const char *s) +grub_size_t +grub_strlen (const char *s) { const char *p = s; @@ -355,9 +355,9 @@ pupa_strlen (const char *s) } static inline void -pupa_reverse (char *str) +grub_reverse (char *str) { - char *p = str + pupa_strlen (str) - 1; + char *p = str + grub_strlen (str) - 1; while (str < p) { @@ -372,7 +372,7 @@ pupa_reverse (char *str) } static char * -pupa_itoa (char *str, int c, unsigned n) +grub_itoa (char *str, int c, unsigned n) { unsigned base = (c == 'x') ? 16 : 10; char *p; @@ -392,12 +392,12 @@ pupa_itoa (char *str, int c, unsigned n) while (n /= base); *p = 0; - pupa_reverse (str); + grub_reverse (str); return p; } static char * -pupa_ftoa (char *str, double f, int round) +grub_ftoa (char *str, double f, int round) { unsigned int intp; unsigned int fractp; @@ -410,12 +410,12 @@ pupa_ftoa (char *str, double f, int round) intp = f; fractp = (f - (float) intp) * power; - pupa_sprintf (str, "%d.%d", intp, fractp); + grub_sprintf (str, "%d.%d", intp, fractp); return str; } int -pupa_vsprintf (char *str, const char *fmt, va_list args) +grub_vsprintf (char *str, const char *fmt, va_list args) { char c; int count = 0; @@ -428,7 +428,7 @@ pupa_vsprintf (char *str, const char *fmt, va_list args) if (str) *str++ = ch; else - pupa_putchar (ch); + grub_putchar (ch); count++; } @@ -468,29 +468,29 @@ pupa_vsprintf (char *str, const char *fmt, va_list args) p = (char *) fmt; /* Read formatting parameters. */ - while (*p && pupa_isdigit (*p)) + while (*p && grub_isdigit (*p)) p++; if (p > fmt) { char s[p - fmt]; - pupa_strncpy (s, fmt, p - fmt); + grub_strncpy (s, fmt, p - fmt); if (s[0] == '0') zerofill = '0'; - format1 = pupa_strtoul (s, 0, 10); + format1 = grub_strtoul (s, 0, 10); fmt = p; if (*p && *p == '.') { p++; fmt++; - while (*p && pupa_isdigit (*p)) + while (*p && grub_isdigit (*p)) p++; if (p > fmt) { char fstr[p - fmt]; - pupa_strncpy (fstr, fmt, p - fmt); - format2 = pupa_strtoul (fstr, 0, 10); + grub_strncpy (fstr, fmt, p - fmt); + format2 = grub_strtoul (fstr, 0, 10); fmt = p; } } @@ -508,12 +508,12 @@ pupa_vsprintf (char *str, const char *fmt, va_list args) case 'u': case 'd': n = va_arg (args, int); - pupa_itoa (tmp, c, n); - if (!rightfill && pupa_strlen (tmp) < format1) - write_fill (zerofill, format1 - pupa_strlen (tmp)); + grub_itoa (tmp, c, n); + if (!rightfill && grub_strlen (tmp) < format1) + write_fill (zerofill, format1 - grub_strlen (tmp)); write_str (tmp); - if (rightfill && pupa_strlen (tmp) < format1) - write_fill (zerofill, format1 - pupa_strlen (tmp)); + if (rightfill && grub_strlen (tmp) < format1) + write_fill (zerofill, format1 - grub_strlen (tmp)); break; case 'c': @@ -525,18 +525,18 @@ pupa_vsprintf (char *str, const char *fmt, va_list args) { float f; f = va_arg (args, double); - pupa_ftoa (tmp, f, format2); - if (!rightfill && pupa_strlen (tmp) < format1) - write_fill (zerofill, format1 - pupa_strlen (tmp)); + grub_ftoa (tmp, f, format2); + if (!rightfill && grub_strlen (tmp) < format1) + write_fill (zerofill, format1 - grub_strlen (tmp)); write_str (tmp); - if (rightfill && pupa_strlen (tmp) < format1) - write_fill (zerofill, format1 - pupa_strlen (tmp)); + if (rightfill && grub_strlen (tmp) < format1) + write_fill (zerofill, format1 - grub_strlen (tmp)); break; } case 'C': { - pupa_uint32_t code = va_arg (args, pupa_uint32_t); + grub_uint32_t code = va_arg (args, grub_uint32_t); int shift; unsigned mask; @@ -588,13 +588,13 @@ pupa_vsprintf (char *str, const char *fmt, va_list args) p = va_arg (args, char *); if (p) { - if (!rightfill && pupa_strlen (p) < format1) - write_fill (zerofill, format1 - pupa_strlen (p)); + if (!rightfill && grub_strlen (p) < format1) + write_fill (zerofill, format1 - grub_strlen (p)); write_str (p); - if (rightfill && pupa_strlen (p) < format1) - write_fill (zerofill, format1 - pupa_strlen (p)); + if (rightfill && grub_strlen (p) < format1) + write_fill (zerofill, format1 - grub_strlen (p)); } else write_str ("(null)"); @@ -612,26 +612,26 @@ pupa_vsprintf (char *str, const char *fmt, va_list args) *str = '\0'; if (count && !str) - pupa_refresh (); + grub_refresh (); return count; } int -pupa_sprintf (char *str, const char *fmt, ...) +grub_sprintf (char *str, const char *fmt, ...) { va_list ap; int ret; va_start (ap, fmt); - ret = pupa_vsprintf (str, fmt, ap); + ret = grub_vsprintf (str, fmt, ap); va_end (ap); return ret; } -pupa_err_t -pupa_split_cmdline (const char *cmdline, pupa_err_t (* getline) (char **), int *argc, char ***argv) +grub_err_t +grub_split_cmdline (const char *cmdline, grub_err_t (* getline) (char **), int *argc, char ***argv) { /* XXX: Fixed size buffer, perhaps this buffer should be dynamically allocated. */ @@ -651,7 +651,7 @@ pupa_split_cmdline (const char *cmdline, pupa_err_t (* getline) (char **), int * /* Get one character from the commandline. If the caller reads beyond the end of the string a new line will be read. This function will not chech for errors, the caller has to check for - pupa_errno. */ + grub_errno. */ char getchar (void) { int c; @@ -703,7 +703,7 @@ pupa_split_cmdline (const char *cmdline, pupa_err_t (* getline) (char **), int * { /* XXX: An env. variable can have characters and digits in its name, are more characters allowed here? */ - while (c && (pupa_isalpha (c) || pupa_isdigit (c))) + while (c && (grub_isalpha (c) || grub_isdigit (c))) { *(p++) = c; c = getchar (); @@ -713,7 +713,7 @@ pupa_split_cmdline (const char *cmdline, pupa_err_t (* getline) (char **), int * *p = '\0'; /* The variable does not exist. */ - val = pupa_env_get (varname); + val = grub_env_get (varname); if (! val) return; @@ -724,7 +724,7 @@ pupa_split_cmdline (const char *cmdline, pupa_err_t (* getline) (char **), int * /* Read one argument. Return 1 if no variables can be read anymore, otherwise return 0. If there is an error, return 1, the caller - has to check pupa_errno. */ + has to check grub_errno. */ int getarg (void) { char c; @@ -741,7 +741,7 @@ pupa_split_cmdline (const char *cmdline, pupa_err_t (* getline) (char **), int * /* Double quote. */ while ((c = getchar ())) { - if (pupa_errno) + if (grub_errno) return 1; /* Read in an escaped character. */ if (c == '\\') @@ -766,7 +766,7 @@ pupa_split_cmdline (const char *cmdline, pupa_err_t (* getline) (char **), int * /* Single quote. */ while ((c = getchar ()) != '\'') { - if (pupa_errno) + if (grub_errno) return 1; *(bp++) = c; @@ -779,8 +779,8 @@ pupa_split_cmdline (const char *cmdline, pupa_err_t (* getline) (char **), int * default: /* A normal option. */ - while (c && (pupa_isalpha (c) - || pupa_isdigit (c) || pupa_isgraph (c))) + while (c && (grub_isalpha (c) + || grub_isdigit (c) || grub_isgraph (c))) { /* Read in an escaped character. */ if (c == '\\') @@ -804,7 +804,7 @@ pupa_split_cmdline (const char *cmdline, pupa_err_t (* getline) (char **), int * break; } - } while (! pupa_isspace (c) && c != '\'' && c != '"'); + } while (! grub_isspace (c) && c != '\'' && c != '"'); return 0; } @@ -820,20 +820,20 @@ pupa_split_cmdline (const char *cmdline, pupa_err_t (* getline) (char **), int * } /* Check if there were no errors. */ - if (pupa_errno) - return pupa_errno; + if (grub_errno) + return grub_errno; /* Reserve memory for the return values. */ - args = pupa_malloc (bp - buffer); + args = grub_malloc (bp - buffer); if (! args) - return pupa_errno; - pupa_memcpy (args, buffer, bp - buffer); + return grub_errno; + grub_memcpy (args, buffer, bp - buffer); - *argv = pupa_malloc (sizeof (char *) * (*argc + 1)); + *argv = grub_malloc (sizeof (char *) * (*argc + 1)); if (! *argv) { - pupa_free (args); - return pupa_errno; + grub_free (args); + return grub_errno; } /* The arguments are separated with 0's, setup argv so it points to diff --git a/kern/mm.c b/kern/mm.c index 2117e147f..ce46eb2ad 100644 --- a/kern/mm.c +++ b/kern/mm.c @@ -1,9 +1,9 @@ /* mm.c - functions for memory manager */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,66 +14,66 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include /* Magic words. */ -#define PUPA_MM_FREE_MAGIC 0x2d3c2808 -#define PUPA_MM_ALLOC_MAGIC 0x6db08fa4 +#define GRUB_MM_FREE_MAGIC 0x2d3c2808 +#define GRUB_MM_ALLOC_MAGIC 0x6db08fa4 -typedef struct pupa_mm_header +typedef struct grub_mm_header { - struct pupa_mm_header *next; - pupa_size_t size; - pupa_size_t magic; -#if PUPA_CPU_SIZEOF_VOID_P == 4 + struct grub_mm_header *next; + grub_size_t size; + grub_size_t magic; +#if GRUB_CPU_SIZEOF_VOID_P == 4 char padding[4]; -#elif PUPA_CPU_SIZEOF_VOID_P == 8 +#elif GRUB_CPU_SIZEOF_VOID_P == 8 char padding[8]; #else # error "unknown word size" #endif } -*pupa_mm_header_t; +*grub_mm_header_t; -#if PUPA_CPU_SIZEOF_VOID_P == 4 -# define PUPA_MM_ALIGN_LOG2 4 -#elif PUPA_CPU_SIZEOF_VOID_P == 8 -# define PUPA_MM_ALIGN_LOG2 8 +#if GRUB_CPU_SIZEOF_VOID_P == 4 +# define GRUB_MM_ALIGN_LOG2 4 +#elif GRUB_CPU_SIZEOF_VOID_P == 8 +# define GRUB_MM_ALIGN_LOG2 8 #endif -#define PUPA_MM_ALIGN (1 << PUPA_MM_ALIGN_LOG2) +#define GRUB_MM_ALIGN (1 << GRUB_MM_ALIGN_LOG2) -typedef struct pupa_mm_region +typedef struct grub_mm_region { - struct pupa_mm_header *first; - struct pupa_mm_region *next; - pupa_addr_t addr; - pupa_size_t size; + struct grub_mm_header *first; + struct grub_mm_region *next; + grub_addr_t addr; + grub_size_t size; } -*pupa_mm_region_t; +*grub_mm_region_t; -static pupa_mm_region_t base; +static grub_mm_region_t base; /* Get a header from the pointer PTR, and set *P and *R to a pointer to the header and a pointer to its region, respectively. PTR must be allocated. */ static void -get_header_from_pointer (void *ptr, pupa_mm_header_t *p, pupa_mm_region_t *r) +get_header_from_pointer (void *ptr, grub_mm_header_t *p, grub_mm_region_t *r) { - if ((unsigned) ptr & (PUPA_MM_ALIGN - 1)) - pupa_fatal ("unaligned pointer %p", ptr); + if ((unsigned) ptr & (GRUB_MM_ALIGN - 1)) + grub_fatal ("unaligned pointer %p", ptr); for (*r = base; *r; *r = (*r)->next) if ((unsigned) ptr > (*r)->addr @@ -81,42 +81,42 @@ get_header_from_pointer (void *ptr, pupa_mm_header_t *p, pupa_mm_region_t *r) break; if (! *r) - pupa_fatal ("out of range pointer %p", ptr); + grub_fatal ("out of range pointer %p", ptr); - *p = (pupa_mm_header_t) ptr - 1; - if ((*p)->magic != PUPA_MM_ALLOC_MAGIC) - pupa_fatal ("alloc magic is broken at %p", *p); + *p = (grub_mm_header_t) ptr - 1; + if ((*p)->magic != GRUB_MM_ALLOC_MAGIC) + grub_fatal ("alloc magic is broken at %p", *p); } /* Initialize a region starting from ADDR and whose size is SIZE, to use it as free space. */ void -pupa_mm_init_region (void *addr, pupa_size_t size) +grub_mm_init_region (void *addr, grub_size_t size) { - pupa_mm_header_t h; - pupa_mm_region_t r, *p, q; + grub_mm_header_t h; + grub_mm_region_t r, *p, q; #if 0 - pupa_printf ("%s:%d: addr=%p, size=%u\n", __FILE__, __LINE__, addr, size); + grub_printf ("%s:%d: addr=%p, size=%u\n", __FILE__, __LINE__, addr, size); #endif /* If this region is too small, ignore it. */ - if (size < PUPA_MM_ALIGN * 2) + if (size < GRUB_MM_ALIGN * 2) return; /* Allocate a region from the head. */ - r = (pupa_mm_region_t) (((pupa_addr_t) addr + PUPA_MM_ALIGN - 1) - & (~(PUPA_MM_ALIGN - 1))); + r = (grub_mm_region_t) (((grub_addr_t) addr + GRUB_MM_ALIGN - 1) + & (~(GRUB_MM_ALIGN - 1))); size -= (char *) r - (char *) addr + sizeof (*r); - h = (pupa_mm_header_t) ((char *) r + PUPA_MM_ALIGN); + h = (grub_mm_header_t) ((char *) r + GRUB_MM_ALIGN); h->next = h; - h->magic = PUPA_MM_FREE_MAGIC; - h->size = (size >> PUPA_MM_ALIGN_LOG2); + h->magic = GRUB_MM_FREE_MAGIC; + h->size = (size >> GRUB_MM_ALIGN_LOG2); r->first = h; - r->addr = (pupa_addr_t) h; - r->size = (h->size << PUPA_MM_ALIGN_LOG2); + r->addr = (grub_addr_t) h; + r->size = (h->size << GRUB_MM_ALIGN_LOG2); /* Find where to insert this region. Put a smaller one before bigger ones, to prevent fragmentations. */ @@ -132,47 +132,47 @@ pupa_mm_init_region (void *addr, pupa_size_t size) buffer starting from *FIRST. ALIGN must be a power of two. Return a non-NULL if successful, otherwise return NULL. */ static void * -pupa_real_malloc (pupa_mm_header_t *first, pupa_size_t n, pupa_size_t align) +grub_real_malloc (grub_mm_header_t *first, grub_size_t n, grub_size_t align) { - pupa_mm_header_t p, q; + grub_mm_header_t p, q; - if ((*first)->magic == PUPA_MM_ALLOC_MAGIC) + if ((*first)->magic == GRUB_MM_ALLOC_MAGIC) return 0; for (q = *first, p = q->next; ; q = p, p = p->next) { - pupa_off_t extra; + grub_off_t extra; - extra = ((pupa_addr_t) (p + 1) >> PUPA_MM_ALIGN_LOG2) % align; + extra = ((grub_addr_t) (p + 1) >> GRUB_MM_ALIGN_LOG2) % align; if (extra) extra = align - extra; if (! p) - pupa_fatal ("null in the ring"); + grub_fatal ("null in the ring"); - if (p->magic != PUPA_MM_FREE_MAGIC) - pupa_fatal ("free magic is broken at %p: 0x%x", p, p->magic); + if (p->magic != GRUB_MM_FREE_MAGIC) + grub_fatal ("free magic is broken at %p: 0x%x", p, p->magic); if (p->size >= n + extra) { if (extra == 0 && p->size == n) { q->next = p->next; - p->magic = PUPA_MM_ALLOC_MAGIC; + p->magic = GRUB_MM_ALLOC_MAGIC; } else if (extra == 0 || p->size == n + extra) { p->size -= n; p += p->size; p->size = n; - p->magic = PUPA_MM_ALLOC_MAGIC; + p->magic = GRUB_MM_ALLOC_MAGIC; } else { - pupa_mm_header_t r; + grub_mm_header_t r; r = p + extra + n; - r->magic = PUPA_MM_FREE_MAGIC; + r->magic = GRUB_MM_FREE_MAGIC; r->size = p->size - extra - n; r->next = p->next; @@ -180,7 +180,7 @@ pupa_real_malloc (pupa_mm_header_t *first, pupa_size_t n, pupa_size_t align) p->next = r; p += extra; p->size = n; - p->magic = PUPA_MM_ALLOC_MAGIC; + p->magic = GRUB_MM_ALLOC_MAGIC; } *first = q; @@ -197,13 +197,13 @@ pupa_real_malloc (pupa_mm_header_t *first, pupa_size_t n, pupa_size_t align) /* Allocate SIZE bytes with the alignment ALIGN and return the pointer. */ void * -pupa_memalign (pupa_size_t align, pupa_size_t size) +grub_memalign (grub_size_t align, grub_size_t size) { - pupa_mm_region_t r; - pupa_size_t n = ((size + PUPA_MM_ALIGN - 1) >> PUPA_MM_ALIGN_LOG2) + 1; + grub_mm_region_t r; + grub_size_t n = ((size + GRUB_MM_ALIGN - 1) >> GRUB_MM_ALIGN_LOG2) + 1; int count = 0; - align = (align >> PUPA_MM_ALIGN_LOG2); + align = (align >> GRUB_MM_ALIGN_LOG2); if (align == 0) align = 1; @@ -213,7 +213,7 @@ pupa_memalign (pupa_size_t align, pupa_size_t size) { void *p; - p = pupa_real_malloc (&(r->first), n, align); + p = grub_real_malloc (&(r->first), n, align); if (p) return p; } @@ -223,13 +223,13 @@ pupa_memalign (pupa_size_t align, pupa_size_t size) { case 0: /* Invalidate disk caches. */ - pupa_disk_cache_invalidate_all (); + grub_disk_cache_invalidate_all (); count++; goto again; case 1: /* Unload unneeded modules. */ - pupa_dl_unload_unneeded (); + grub_dl_unload_unneeded (); count++; goto again; @@ -237,43 +237,43 @@ pupa_memalign (pupa_size_t align, pupa_size_t size) break; } - pupa_error (PUPA_ERR_OUT_OF_MEMORY, "out of memory"); + grub_error (GRUB_ERR_OUT_OF_MEMORY, "out of memory"); return 0; } /* Allocate SIZE bytes and return the pointer. */ void * -pupa_malloc (pupa_size_t size) +grub_malloc (grub_size_t size) { - return pupa_memalign (0, size); + return grub_memalign (0, size); } /* Deallocate the pointer PTR. */ void -pupa_free (void *ptr) +grub_free (void *ptr) { - pupa_mm_header_t p; - pupa_mm_region_t r; + grub_mm_header_t p; + grub_mm_region_t r; if (! ptr) return; get_header_from_pointer (ptr, &p, &r); - if (r->first->magic == PUPA_MM_ALLOC_MAGIC) + if (r->first->magic == GRUB_MM_ALLOC_MAGIC) { - p->magic = PUPA_MM_FREE_MAGIC; + p->magic = GRUB_MM_FREE_MAGIC; r->first = p->next = p; } else { - pupa_mm_header_t q; + grub_mm_header_t q; #if 0 q = r->first; do { - pupa_printf ("%s:%d: q=%p, q->size=0x%x, q->magic=0x%x\n", + grub_printf ("%s:%d: q=%p, q->size=0x%x, q->magic=0x%x\n", __FILE__, __LINE__, q, q->size, q->magic); q = q->next; } @@ -282,14 +282,14 @@ pupa_free (void *ptr) for (q = r->first; q >= p || q->next <= p; q = q->next) { - if (q->magic != PUPA_MM_FREE_MAGIC) - pupa_fatal ("free magic is broken at %p: 0x%x", q, q->magic); + if (q->magic != GRUB_MM_FREE_MAGIC) + grub_fatal ("free magic is broken at %p: 0x%x", q, q->magic); if (q >= q->next && (q < p || q->next > p)) break; } - p->magic = PUPA_MM_FREE_MAGIC; + p->magic = GRUB_MM_FREE_MAGIC; p->next = q->next; q->next = p; @@ -314,67 +314,67 @@ pupa_free (void *ptr) /* Reallocate SIZE bytes and return the pointer. The contents will be the same as that of PTR. */ void * -pupa_realloc (void *ptr, pupa_size_t size) +grub_realloc (void *ptr, grub_size_t size) { - pupa_mm_header_t p; - pupa_mm_region_t r; + grub_mm_header_t p; + grub_mm_region_t r; void *q; - pupa_size_t n; + grub_size_t n; if (! ptr) - return pupa_malloc (size); + return grub_malloc (size); if (! size) { - pupa_free (ptr); + grub_free (ptr); return 0; } /* FIXME: Not optimal. */ - n = ((size + PUPA_MM_ALIGN - 1) >> PUPA_MM_ALIGN_LOG2) + 1; + n = ((size + GRUB_MM_ALIGN - 1) >> GRUB_MM_ALIGN_LOG2) + 1; get_header_from_pointer (ptr, &p, &r); if (p->size >= n) return p; - q = pupa_malloc (size); + q = grub_malloc (size); if (! q) return q; - pupa_memcpy (q, ptr, size); - pupa_free (ptr); + grub_memcpy (q, ptr, size); + grub_free (ptr); return q; } #if MM_DEBUG void -pupa_mm_dump (unsigned lineno) +grub_mm_dump (unsigned lineno) { - pupa_mm_region_t r; + grub_mm_region_t r; - pupa_printf ("called at line %u\n", lineno); + grub_printf ("called at line %u\n", lineno); for (r = base; r; r = r->next) { - pupa_mm_header_t p; + grub_mm_header_t p; - for (p = (pupa_mm_header_t) ((r->addr + PUPA_MM_ALIGN - 1) - & (~(PUPA_MM_ALIGN - 1))); - (pupa_addr_t) p < r->addr + r->size; + for (p = (grub_mm_header_t) ((r->addr + GRUB_MM_ALIGN - 1) + & (~(GRUB_MM_ALIGN - 1))); + (grub_addr_t) p < r->addr + r->size; p++) { switch (p->magic) { - case PUPA_MM_FREE_MAGIC: - pupa_printf ("F:%p:%u:%p\n", - p, p->size << PUPA_MM_ALIGN_LOG2, p->next); + case GRUB_MM_FREE_MAGIC: + grub_printf ("F:%p:%u:%p\n", + p, p->size << GRUB_MM_ALIGN_LOG2, p->next); break; - case PUPA_MM_ALLOC_MAGIC: - pupa_printf ("A:%p:%u\n", p, p->size << PUPA_MM_ALIGN_LOG2); + case GRUB_MM_ALLOC_MAGIC: + grub_printf ("A:%p:%u\n", p, p->size << GRUB_MM_ALIGN_LOG2); break; } } } - pupa_printf ("\n"); + grub_printf ("\n"); } #endif /* MM_DEBUG */ diff --git a/kern/powerpc/ieee1275/init.c b/kern/powerpc/ieee1275/init.c index 16286a7b6..fcf94e74d 100644 --- a/kern/powerpc/ieee1275/init.c +++ b/kern/powerpc/ieee1275/init.c @@ -1,6 +1,6 @@ -/* init.c -- Initialize PUPA on the newworld mac (PPC). */ +/* init.c -- Initialize GRUB on the newworld mac (PPC). */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003, 2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,24 +18,24 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -void pupa_ofdisk_init (void); -void pupa_console_init (void); +void grub_ofdisk_init (void); +void grub_console_init (void); /* XXX: Modules are not yet supported. */ -pupa_addr_t pupa_end_addr = -1; -pupa_addr_t pupa_total_module_size = 0; +grub_addr_t grub_end_addr = -1; +grub_addr_t grub_total_module_size = 0; void abort (void) @@ -44,63 +44,63 @@ abort (void) } void -pupa_machine_init (void) +grub_machine_init (void) { void *mem; - if (pupa_ieee1275_claim ((void *) 0x300000, 0x150000, 0, &mem) == -1) + if (grub_ieee1275_claim ((void *) 0x300000, 0x150000, 0, &mem) == -1) abort (); /* Damn, we are in trouble! */ /* The memory allocations were copied from yaboot. */ - pupa_mm_init_region ((void *) 0x300000, 0x150000); + grub_mm_init_region ((void *) 0x300000, 0x150000); /* XXX: Loadable modules are not supported. */ - pupa_env_set ("prefix", ""); + grub_env_set ("prefix", ""); - pupa_ext2_init (); - pupa_ofdisk_init (); - pupa_console_init (); + grub_ext2_init (); + grub_ofdisk_init (); + grub_console_init (); } int -pupa_arch_dl_check_header (void *ehdr __attribute ((unused)), - pupa_size_t size __attribute ((unused))) +grub_arch_dl_check_header (void *ehdr __attribute ((unused)), + grub_size_t size __attribute ((unused))) { return 0; } -pupa_err_t -pupa_arch_dl_relocate_symbols (pupa_dl_t mod __attribute ((unused)), +grub_err_t +grub_arch_dl_relocate_symbols (grub_dl_t mod __attribute ((unused)), void *ehdr __attribute ((unused))) { return 0; } void -pupa_stop (void) +grub_stop (void) { for (;;); } void -pupa_register_exported_symbols (void) +grub_register_exported_symbols (void) { } -pupa_uint32_t -pupa_get_rtc (void) +grub_uint32_t +grub_get_rtc (void) { return 0; } int -pupa_setjmp (pupa_jmp_buf env __attribute ((unused))) +grub_setjmp (grub_jmp_buf env __attribute ((unused))) { return 0; } void -pupa_longjmp (pupa_jmp_buf env __attribute ((unused)), +grub_longjmp (grub_jmp_buf env __attribute ((unused)), int val __attribute ((unused))) { } diff --git a/kern/powerpc/ieee1275/openfw.c b/kern/powerpc/ieee1275/openfw.c index 89dd5c642..eb741a7b1 100644 --- a/kern/powerpc/ieee1275/openfw.c +++ b/kern/powerpc/ieee1275/openfw.c @@ -1,6 +1,6 @@ /* openfw.c -- Open firmware support funtions. */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003, 2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,59 +18,59 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include +#include +#include +#include +#include /* Iterate through all device aliasses. Thisfunction can be used to find a device of a specific type. */ -pupa_err_t -pupa_devalias_iterate (int (*hook) (struct pupa_ieee1275_devalias *alias)) +grub_err_t +grub_devalias_iterate (int (*hook) (struct grub_ieee1275_devalias *alias)) { - pupa_ieee1275_phandle_t devalias; + grub_ieee1275_phandle_t devalias; char aliasname[32]; int actual; - struct pupa_ieee1275_devalias alias; + struct grub_ieee1275_devalias alias; - if (pupa_ieee1275_finddevice ("/aliases", &devalias)) + if (grub_ieee1275_finddevice ("/aliases", &devalias)) return -1; /* XXX: Is this the right way to find the first property? */ aliasname[0] = '\0'; /* XXX: Are the while conditions correct? */ - while (pupa_ieee1275_next_property (devalias, aliasname, aliasname, &actual) + while (grub_ieee1275_next_property (devalias, aliasname, aliasname, &actual) || actual) { - pupa_ieee1275_phandle_t dev; - pupa_size_t pathlen; + grub_ieee1275_phandle_t dev; + grub_size_t pathlen; char *devpath; /* XXX: This should be large enough for any possible case. */ char devtype[64]; - pupa_ieee1275_get_property_length (devalias, aliasname, &pathlen); - devpath = pupa_malloc (pathlen); + grub_ieee1275_get_property_length (devalias, aliasname, &pathlen); + devpath = grub_malloc (pathlen); if (! devpath) - return pupa_errno; + return grub_errno; - if (pupa_ieee1275_get_property (devalias, aliasname, devpath, pathlen, + if (grub_ieee1275_get_property (devalias, aliasname, devpath, pathlen, &actual)) { - pupa_free (devpath); + grub_free (devpath); continue; } - if (pupa_ieee1275_finddevice (devpath, &dev)) + if (grub_ieee1275_finddevice (devpath, &dev)) { - pupa_free (devpath); + grub_free (devpath); continue; } - if (pupa_ieee1275_get_property (dev, "device_type", devtype, sizeof devtype, + if (grub_ieee1275_get_property (dev, "device_type", devtype, sizeof devtype, &actual)) { - pupa_free (devpath); + grub_free (devpath); continue; } @@ -79,7 +79,7 @@ pupa_devalias_iterate (int (*hook) (struct pupa_ieee1275_devalias *alias)) alias.type = devtype; hook (&alias); - pupa_free (devpath); + grub_free (devpath); } return 0; diff --git a/kern/rescue.c b/kern/rescue.c index 9c9382342..6ee2a300a 100644 --- a/kern/rescue.c +++ b/kern/rescue.c @@ -1,6 +1,6 @@ /* rescue.c - rescue mode */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002, 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,43 +18,43 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#define PUPA_RESCUE_BUF_SIZE 256 -#define PUPA_RESCUE_MAX_ARGS 20 +#define GRUB_RESCUE_BUF_SIZE 256 +#define GRUB_RESCUE_MAX_ARGS 20 -struct pupa_rescue_command +struct grub_rescue_command { const char *name; void (*func) (int argc, char *argv[]); const char *message; - struct pupa_rescue_command *next; + struct grub_rescue_command *next; }; -typedef struct pupa_rescue_command *pupa_rescue_command_t; +typedef struct grub_rescue_command *grub_rescue_command_t; -static char linebuf[PUPA_RESCUE_BUF_SIZE]; +static char linebuf[GRUB_RESCUE_BUF_SIZE]; -static pupa_rescue_command_t pupa_rescue_command_list; +static grub_rescue_command_t grub_rescue_command_list; void -pupa_rescue_register_command (const char *name, +grub_rescue_register_command (const char *name, void (*func) (int argc, char *argv[]), const char *message) { - pupa_rescue_command_t cmd; + grub_rescue_command_t cmd; - cmd = (pupa_rescue_command_t) pupa_malloc (sizeof (*cmd)); + cmd = (grub_rescue_command_t) grub_malloc (sizeof (*cmd)); if (! cmd) return; @@ -62,42 +62,42 @@ pupa_rescue_register_command (const char *name, cmd->func = func; cmd->message = message; - cmd->next = pupa_rescue_command_list; - pupa_rescue_command_list = cmd; + cmd->next = grub_rescue_command_list; + grub_rescue_command_list = cmd; } void -pupa_rescue_unregister_command (const char *name) +grub_rescue_unregister_command (const char *name) { - pupa_rescue_command_t *p, q; + grub_rescue_command_t *p, q; - for (p = &pupa_rescue_command_list, q = *p; q; p = &(q->next), q = q->next) - if (pupa_strcmp (name, q->name) == 0) + for (p = &grub_rescue_command_list, q = *p; q; p = &(q->next), q = q->next) + if (grub_strcmp (name, q->name) == 0) { *p = q->next; - pupa_free (q); + grub_free (q); break; } } /* Prompt to input a command and read the line. */ static void -pupa_rescue_get_command_line (const char *prompt) +grub_rescue_get_command_line (const char *prompt) { int c; int pos = 0; - pupa_printf (prompt); - pupa_memset (linebuf, 0, PUPA_RESCUE_BUF_SIZE); + grub_printf (prompt); + grub_memset (linebuf, 0, GRUB_RESCUE_BUF_SIZE); - while ((c = PUPA_TERM_ASCII_CHAR (pupa_getkey ())) != '\n' && c != '\r') + while ((c = GRUB_TERM_ASCII_CHAR (grub_getkey ())) != '\n' && c != '\r') { - if (pupa_isprint (c)) + if (grub_isprint (c)) { - if (pos < PUPA_RESCUE_BUF_SIZE - 1) + if (pos < GRUB_RESCUE_BUF_SIZE - 1) { linebuf[pos++] = c; - pupa_putchar (c); + grub_putchar (c); } } else if (c == '\b') @@ -105,45 +105,45 @@ pupa_rescue_get_command_line (const char *prompt) if (pos > 0) { linebuf[--pos] = 0; - pupa_putchar (c); - pupa_putchar (' '); - pupa_putchar (c); + grub_putchar (c); + grub_putchar (' '); + grub_putchar (c); } } - pupa_refresh (); + grub_refresh (); } - pupa_putchar ('\n'); - pupa_refresh (); + grub_putchar ('\n'); + grub_refresh (); } /* boot */ static void -pupa_rescue_cmd_boot (int argc __attribute__ ((unused)), +grub_rescue_cmd_boot (int argc __attribute__ ((unused)), char *argv[] __attribute__ ((unused))) { - pupa_loader_boot (); + grub_loader_boot (); } /* cat FILE */ static void -pupa_rescue_cmd_cat (int argc, char *argv[]) +grub_rescue_cmd_cat (int argc, char *argv[]) { - pupa_file_t file; - char buf[PUPA_DISK_SECTOR_SIZE]; - pupa_ssize_t size; + grub_file_t file; + char buf[GRUB_DISK_SECTOR_SIZE]; + grub_ssize_t size; if (argc < 1) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "no file specified"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified"); return; } - file = pupa_file_open (argv[0]); + file = grub_file_open (argv[0]); if (! file) return; - while ((size = pupa_file_read (file, buf, sizeof (buf))) > 0) + while ((size = grub_file_read (file, buf, sizeof (buf))) > 0) { int i; @@ -151,136 +151,136 @@ pupa_rescue_cmd_cat (int argc, char *argv[]) { unsigned char c = buf[i]; - if (pupa_isprint (c) || pupa_isspace (c)) - pupa_putchar (c); + if (grub_isprint (c) || grub_isspace (c)) + grub_putchar (c); else { - pupa_setcolorstate (PUPA_TERM_COLOR_HIGHLIGHT); - pupa_printf ("<%x>", (int) c); - pupa_setcolorstate (PUPA_TERM_COLOR_STANDARD); + grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); + grub_printf ("<%x>", (int) c); + grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); } } } - pupa_putchar ('\n'); - pupa_refresh (); - pupa_file_close (file); + grub_putchar ('\n'); + grub_refresh (); + grub_file_close (file); } static int -pupa_rescue_print_disks (const char *name) +grub_rescue_print_disks (const char *name) { - pupa_device_t dev; - auto int print_partition (const pupa_partition_t p); + grub_device_t dev; + auto int print_partition (const grub_partition_t p); - int print_partition (const pupa_partition_t p) + int print_partition (const grub_partition_t p) { - char *pname = pupa_partition_get_name (p); + char *pname = grub_partition_get_name (p); if (pname) { - pupa_printf ("(%s,%s) ", name, pname); - pupa_free (pname); + grub_printf ("(%s,%s) ", name, pname); + grub_free (pname); } return 0; } - dev = pupa_device_open (name); - pupa_errno = PUPA_ERR_NONE; + dev = grub_device_open (name); + grub_errno = GRUB_ERR_NONE; if (dev) { - pupa_printf ("(%s) ", name); + grub_printf ("(%s) ", name); if (dev->disk && dev->disk->has_partitions) { - pupa_partition_iterate (dev->disk, print_partition); - pupa_errno = PUPA_ERR_NONE; + grub_partition_iterate (dev->disk, print_partition); + grub_errno = GRUB_ERR_NONE; } - pupa_device_close (dev); + grub_device_close (dev); } return 0; } static int -pupa_rescue_print_files (const char *filename, int dir) +grub_rescue_print_files (const char *filename, int dir) { - pupa_printf ("%s%s ", filename, dir ? "/" : ""); + grub_printf ("%s%s ", filename, dir ? "/" : ""); return 0; } /* ls [ARG] */ static void -pupa_rescue_cmd_ls (int argc, char *argv[]) +grub_rescue_cmd_ls (int argc, char *argv[]) { if (argc < 1) { - pupa_disk_dev_iterate (pupa_rescue_print_disks); - pupa_putchar ('\n'); - pupa_refresh (); + grub_disk_dev_iterate (grub_rescue_print_disks); + grub_putchar ('\n'); + grub_refresh (); } else { char *device_name; - pupa_device_t dev; - pupa_fs_t fs; + grub_device_t dev; + grub_fs_t fs; char *path; - device_name = pupa_file_get_device_name (argv[0]); - dev = pupa_device_open (device_name); + device_name = grub_file_get_device_name (argv[0]); + dev = grub_device_open (device_name); if (! dev) goto fail; - fs = pupa_fs_probe (dev); - path = pupa_strchr (argv[0], '/'); + fs = grub_fs_probe (dev); + path = grub_strchr (argv[0], '/'); if (! path && ! device_name) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "invalid argument"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument"); goto fail; } if (! path) { - if (pupa_errno == PUPA_ERR_UNKNOWN_FS) - pupa_errno = PUPA_ERR_NONE; + if (grub_errno == GRUB_ERR_UNKNOWN_FS) + grub_errno = GRUB_ERR_NONE; - pupa_printf ("(%s): Filesystem is %s.\n", + grub_printf ("(%s): Filesystem is %s.\n", device_name, fs ? fs->name : "unknown"); } else if (fs) { - (fs->dir) (dev, path, pupa_rescue_print_files); - pupa_putchar ('\n'); - pupa_refresh (); + (fs->dir) (dev, path, grub_rescue_print_files); + grub_putchar ('\n'); + grub_refresh (); } fail: if (dev) - pupa_device_close (dev); + grub_device_close (dev); - pupa_free (device_name); + grub_free (device_name); } } /* help */ static void -pupa_rescue_cmd_help (int argc __attribute__ ((unused)), +grub_rescue_cmd_help (int argc __attribute__ ((unused)), char *argv[] __attribute__ ((unused))) { - pupa_rescue_command_t p, q; + grub_rescue_command_t p, q; /* Sort the commands. This is not a good algorithm, but this is enough, because rescue mode has a small number of commands. */ - for (p = pupa_rescue_command_list; p; p = p->next) + for (p = grub_rescue_command_list; p; p = p->next) for (q = p->next; q; q = q->next) - if (pupa_strcmp (p->name, q->name) > 0) + if (grub_strcmp (p->name, q->name) > 0) { - struct pupa_rescue_command tmp; + struct grub_rescue_command tmp; tmp.name = p->name; tmp.func = p->func; @@ -296,323 +296,323 @@ pupa_rescue_cmd_help (int argc __attribute__ ((unused)), } /* Print them. */ - for (p = pupa_rescue_command_list; p; p = p->next) - pupa_printf ("%s\t%s\n", p->name, p->message); + for (p = grub_rescue_command_list; p; p = p->next) + grub_printf ("%s\t%s\n", p->name, p->message); } #if 0 static void -pupa_rescue_cmd_info (void) +grub_rescue_cmd_info (void) { - extern void pupa_disk_cache_get_performance (unsigned long *, + extern void grub_disk_cache_get_performance (unsigned long *, unsigned long *); unsigned long hits, misses; - pupa_disk_cache_get_performance (&hits, &misses); - pupa_printf ("Disk cache: hits = %u, misses = %u ", hits, misses); + grub_disk_cache_get_performance (&hits, &misses); + grub_printf ("Disk cache: hits = %u, misses = %u ", hits, misses); if (hits + misses) { unsigned long ratio = hits * 10000 / (hits + misses); - pupa_printf ("(%u.%u%%)\n", ratio / 100, ratio % 100); + grub_printf ("(%u.%u%%)\n", ratio / 100, ratio % 100); } else - pupa_printf ("(N/A)\n"); + grub_printf ("(N/A)\n"); } #endif /* root [DEVICE] */ static void -pupa_rescue_cmd_root (int argc, char *argv[]) +grub_rescue_cmd_root (int argc, char *argv[]) { - pupa_device_t dev; - pupa_fs_t fs; + grub_device_t dev; + grub_fs_t fs; if (argc > 0) { - char *device_name = pupa_file_get_device_name (argv[0]); + char *device_name = grub_file_get_device_name (argv[0]); if (! device_name) return; - pupa_device_set_root (device_name); - pupa_free (device_name); + grub_device_set_root (device_name); + grub_free (device_name); } - dev = pupa_device_open (0); + dev = grub_device_open (0); if (! dev) return; - fs = pupa_fs_probe (dev); - if (pupa_errno == PUPA_ERR_UNKNOWN_FS) - pupa_errno = PUPA_ERR_NONE; + fs = grub_fs_probe (dev); + if (grub_errno == GRUB_ERR_UNKNOWN_FS) + grub_errno = GRUB_ERR_NONE; - pupa_printf ("(%s): Filesystem is %s.\n", - pupa_device_get_root (), fs ? fs->name : "unknown"); + grub_printf ("(%s): Filesystem is %s.\n", + grub_device_get_root (), fs ? fs->name : "unknown"); - pupa_device_close (dev); + grub_device_close (dev); } #if 0 static void -pupa_rescue_cmd_testload (int argc, char *argv[]) +grub_rescue_cmd_testload (int argc, char *argv[]) { - pupa_file_t file; + grub_file_t file; char *buf; - pupa_ssize_t size; - pupa_ssize_t pos; + grub_ssize_t size; + grub_ssize_t pos; auto void read_func (unsigned long sector, unsigned offset, unsigned len); void read_func (unsigned long sector __attribute__ ((unused)), unsigned offset __attribute__ ((unused)), unsigned len __attribute__ ((unused))) { - pupa_putchar ('.'); - pupa_refresh (); + grub_putchar ('.'); + grub_refresh (); } if (argc < 1) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "no file specified"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified"); return; } - file = pupa_file_open (argv[0]); + file = grub_file_open (argv[0]); if (! file) return; - size = pupa_file_size (file) & ~(PUPA_DISK_SECTOR_SIZE - 1); + size = grub_file_size (file) & ~(GRUB_DISK_SECTOR_SIZE - 1); if (size == 0) { - pupa_file_close (file); + grub_file_close (file); return; } - buf = pupa_malloc (size); + buf = grub_malloc (size); if (! buf) goto fail; - pupa_printf ("Reading %s sequentially", argv[0]); + grub_printf ("Reading %s sequentially", argv[0]); file->read_hook = read_func; - if (pupa_file_read (file, buf, size) != size) + if (grub_file_read (file, buf, size) != size) goto fail; - pupa_printf (" Done.\n"); + grub_printf (" Done.\n"); /* Read sequentially again. */ - pupa_printf ("Reading %s sequentially again", argv[0]); - if (pupa_file_seek (file, 0) < 0) + grub_printf ("Reading %s sequentially again", argv[0]); + if (grub_file_seek (file, 0) < 0) goto fail; - for (pos = 0; pos < size; pos += PUPA_DISK_SECTOR_SIZE) + for (pos = 0; pos < size; pos += GRUB_DISK_SECTOR_SIZE) { - char sector[PUPA_DISK_SECTOR_SIZE]; + char sector[GRUB_DISK_SECTOR_SIZE]; - if (pupa_file_read (file, sector, PUPA_DISK_SECTOR_SIZE) - != PUPA_DISK_SECTOR_SIZE) + if (grub_file_read (file, sector, GRUB_DISK_SECTOR_SIZE) + != GRUB_DISK_SECTOR_SIZE) goto fail; - if (pupa_memcmp (sector, buf + pos, PUPA_DISK_SECTOR_SIZE) != 0) + if (grub_memcmp (sector, buf + pos, GRUB_DISK_SECTOR_SIZE) != 0) { - pupa_printf ("\nDiffers in %d\n", pos); + grub_printf ("\nDiffers in %d\n", pos); goto fail; } } - pupa_printf (" Done.\n"); + grub_printf (" Done.\n"); /* Read backwards and compare. */ - pupa_printf ("Reading %s backwards", argv[0]); + grub_printf ("Reading %s backwards", argv[0]); pos = size; while (pos > 0) { - char sector[PUPA_DISK_SECTOR_SIZE]; + char sector[GRUB_DISK_SECTOR_SIZE]; - pos -= PUPA_DISK_SECTOR_SIZE; + pos -= GRUB_DISK_SECTOR_SIZE; - if (pupa_file_seek (file, pos) < 0) + if (grub_file_seek (file, pos) < 0) goto fail; - if (pupa_file_read (file, sector, PUPA_DISK_SECTOR_SIZE) - != PUPA_DISK_SECTOR_SIZE) + if (grub_file_read (file, sector, GRUB_DISK_SECTOR_SIZE) + != GRUB_DISK_SECTOR_SIZE) goto fail; - if (pupa_memcmp (sector, buf + pos, PUPA_DISK_SECTOR_SIZE) != 0) + if (grub_memcmp (sector, buf + pos, GRUB_DISK_SECTOR_SIZE) != 0) { int i; - pupa_printf ("\nDiffers in %d\n", pos); + grub_printf ("\nDiffers in %d\n", pos); - for (i = 0; i < PUPA_DISK_SECTOR_SIZE; i++) - pupa_putchar (buf[pos + i]); + for (i = 0; i < GRUB_DISK_SECTOR_SIZE; i++) + grub_putchar (buf[pos + i]); if (i) - pupa_refresh (); + grub_refresh (); goto fail; } } - pupa_printf (" Done.\n"); + grub_printf (" Done.\n"); fail: - pupa_file_close (file); - pupa_free (buf); + grub_file_close (file); + grub_free (buf); } #endif /* dump ADDRESS [SIZE] */ static void -pupa_rescue_cmd_dump (int argc, char *argv[]) +grub_rescue_cmd_dump (int argc, char *argv[]) { - pupa_uint8_t *addr; - pupa_size_t size = 4; + grub_uint8_t *addr; + grub_size_t size = 4; if (argc == 0) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "no address specified"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "no address specified"); return; } - addr = (pupa_uint8_t *) pupa_strtoul (argv[0], 0, 0); - if (pupa_errno) + addr = (grub_uint8_t *) grub_strtoul (argv[0], 0, 0); + if (grub_errno) return; if (argc > 1) - size = (pupa_size_t) pupa_strtoul (argv[1], 0, 0); + size = (grub_size_t) grub_strtoul (argv[1], 0, 0); while (size--) { - pupa_printf ("%x%x ", *addr >> 4, *addr & 0xf); + grub_printf ("%x%x ", *addr >> 4, *addr & 0xf); addr++; } } /* insmod MODULE */ static void -pupa_rescue_cmd_insmod (int argc, char *argv[]) +grub_rescue_cmd_insmod (int argc, char *argv[]) { char *p; - pupa_dl_t mod; + grub_dl_t mod; if (argc == 0) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "no module specified"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified"); return; } - p = pupa_strchr (argv[0], '/'); + p = grub_strchr (argv[0], '/'); if (! p) - mod = pupa_dl_load (argv[0]); + mod = grub_dl_load (argv[0]); else - mod = pupa_dl_load_file (argv[0]); + mod = grub_dl_load_file (argv[0]); if (mod) - pupa_dl_ref (mod); + grub_dl_ref (mod); } /* rmmod MODULE */ static void -pupa_rescue_cmd_rmmod (int argc, char *argv[]) +grub_rescue_cmd_rmmod (int argc, char *argv[]) { - pupa_dl_t mod; + grub_dl_t mod; if (argc == 0) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "no module specified"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified"); return; } - mod = pupa_dl_get (argv[0]); + mod = grub_dl_get (argv[0]); if (! mod) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "no such module"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "no such module"); return; } - if (! pupa_dl_unref (mod)) - pupa_dl_unload (mod); + if (! grub_dl_unref (mod)) + grub_dl_unload (mod); } /* lsmod */ static void -pupa_rescue_cmd_lsmod (int argc __attribute__ ((unused)), +grub_rescue_cmd_lsmod (int argc __attribute__ ((unused)), char *argv[] __attribute__ ((unused))) { - auto int print_module (pupa_dl_t mod); + auto int print_module (grub_dl_t mod); - int print_module (pupa_dl_t mod) + int print_module (grub_dl_t mod) { - pupa_dl_dep_t dep; + grub_dl_dep_t dep; - pupa_printf ("%s\t%d\t\t", mod->name, mod->ref_count); + grub_printf ("%s\t%d\t\t", mod->name, mod->ref_count); for (dep = mod->dep; dep; dep = dep->next) { if (dep != mod->dep) - pupa_putchar (','); + grub_putchar (','); - pupa_printf ("%s", dep->mod->name); + grub_printf ("%s", dep->mod->name); } - pupa_putchar ('\n'); - pupa_refresh (); + grub_putchar ('\n'); + grub_refresh (); return 0; } - pupa_printf ("Name\tRef Count\tDependencies\n"); - pupa_dl_iterate (print_module); + grub_printf ("Name\tRef Count\tDependencies\n"); + grub_dl_iterate (print_module); } /* set ENVVAR=VALUE */ static void -pupa_rescue_cmd_set (int argc, char *argv[]) +grub_rescue_cmd_set (int argc, char *argv[]) { char *var; char *val; - auto int print_env (struct pupa_env_var *env); + auto int print_env (struct grub_env_var *env); - int print_env (struct pupa_env_var *env) + int print_env (struct grub_env_var *env) { - pupa_printf ("%s=%s\n", env->name, env->value); + grub_printf ("%s=%s\n", env->name, env->value); return 0; } if (argc < 1) { - pupa_env_iterate (print_env); + grub_env_iterate (print_env); return; } var = argv[0]; - val = pupa_strchr (var, '='); + val = grub_strchr (var, '='); if (! val) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "not an assignment"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "not an assignment"); return; } val[0] = 0; - pupa_env_set (var, val + 1); + grub_env_set (var, val + 1); val[0] = '='; } static void -pupa_rescue_cmd_unset (int argc, char *argv[]) +grub_rescue_cmd_unset (int argc, char *argv[]) { if (argc < 1) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "no environment variable specified"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "no environment variable specified"); return; } - pupa_env_unset (argv[0]); + grub_env_unset (argv[0]); } static void attempt_normal_mode (void) { - pupa_rescue_command_t cmd; + grub_rescue_command_t cmd; - for (cmd = pupa_rescue_command_list; cmd; cmd = cmd->next) + for (cmd = grub_rescue_command_list; cmd; cmd = cmd->next) { - if (pupa_strcmp ("normal", cmd->name) == 0) + if (grub_strcmp ("normal", cmd->name) == 0) { (cmd->func) (0, 0); break; @@ -622,13 +622,13 @@ attempt_normal_mode (void) /* Enter the rescue mode. */ void -pupa_enter_rescue_mode (void) +grub_enter_rescue_mode (void) { - auto pupa_err_t getline (char **line); + auto grub_err_t getline (char **line); - pupa_err_t getline (char **line) + grub_err_t getline (char **line) { - pupa_rescue_get_command_line ("> "); + grub_rescue_get_command_line ("> "); *line = linebuf; return 0; } @@ -636,29 +636,29 @@ pupa_enter_rescue_mode (void) /* First of all, attempt to execute the normal mode. */ attempt_normal_mode (); - pupa_printf ("Entering into rescue mode...\n"); + grub_printf ("Entering into rescue mode...\n"); - pupa_rescue_register_command ("boot", pupa_rescue_cmd_boot, + grub_rescue_register_command ("boot", grub_rescue_cmd_boot, "boot an operating system"); - pupa_rescue_register_command ("cat", pupa_rescue_cmd_cat, + grub_rescue_register_command ("cat", grub_rescue_cmd_cat, "show the contents of a file"); - pupa_rescue_register_command ("help", pupa_rescue_cmd_help, + grub_rescue_register_command ("help", grub_rescue_cmd_help, "show this message"); - pupa_rescue_register_command ("ls", pupa_rescue_cmd_ls, + grub_rescue_register_command ("ls", grub_rescue_cmd_ls, "list devices or files"); - pupa_rescue_register_command ("root", pupa_rescue_cmd_root, + grub_rescue_register_command ("root", grub_rescue_cmd_root, "set the root device"); - pupa_rescue_register_command ("dump", pupa_rescue_cmd_dump, + grub_rescue_register_command ("dump", grub_rescue_cmd_dump, "dump memory"); - pupa_rescue_register_command ("insmod", pupa_rescue_cmd_insmod, + grub_rescue_register_command ("insmod", grub_rescue_cmd_insmod, "insert a module"); - pupa_rescue_register_command ("rmmod", pupa_rescue_cmd_rmmod, + grub_rescue_register_command ("rmmod", grub_rescue_cmd_rmmod, "remove a module"); - pupa_rescue_register_command ("lsmod", pupa_rescue_cmd_lsmod, + grub_rescue_register_command ("lsmod", grub_rescue_cmd_lsmod, "show loaded modules"); - pupa_rescue_register_command ("set", pupa_rescue_cmd_set, + grub_rescue_register_command ("set", grub_rescue_cmd_set, "set an environment variable"); - pupa_rescue_register_command ("unset", pupa_rescue_cmd_unset, + grub_rescue_register_command ("unset", grub_rescue_cmd_unset, "remove an environment variable"); while (1) @@ -666,26 +666,26 @@ pupa_enter_rescue_mode (void) char *line = linebuf; char *name; int n; - pupa_rescue_command_t cmd; + grub_rescue_command_t cmd; char **args; /* Print an error, if any. */ - pupa_print_error (); - pupa_errno = PUPA_ERR_NONE; + grub_print_error (); + grub_errno = GRUB_ERR_NONE; /* Get a command line. */ - pupa_rescue_get_command_line ("pupa rescue> "); + grub_rescue_get_command_line ("grub rescue> "); - if (pupa_split_cmdline (line, getline, &n, &args)) + if (grub_split_cmdline (line, getline, &n, &args)) continue; /* In case of an assignment set the environment accordingly instead of calling a function. */ - if (n == 0 && pupa_strchr (line, '=')) + if (n == 0 && grub_strchr (line, '=')) { - char *val = pupa_strchr (args[0], '='); + char *val = grub_strchr (args[0], '='); val[0] = 0; - pupa_env_set (args[0], val + 1); + grub_env_set (args[0], val + 1); val[0] = '='; continue; } @@ -698,9 +698,9 @@ pupa_enter_rescue_mode (void) continue; /* Find the command and execute it. */ - for (cmd = pupa_rescue_command_list; cmd; cmd = cmd->next) + for (cmd = grub_rescue_command_list; cmd; cmd = cmd->next) { - if (pupa_strcmp (name, cmd->name) == 0) + if (grub_strcmp (name, cmd->name) == 0) { (cmd->func) (n, &args[1]); break; @@ -710,8 +710,8 @@ pupa_enter_rescue_mode (void) /* If not found, print an error message. */ if (! cmd) { - pupa_printf ("Unknown command `%s'\n", name); - pupa_printf ("Try `help' for usage\n"); + grub_printf ("Unknown command `%s'\n", name); + grub_printf ("Try `help' for usage\n"); } } } diff --git a/kern/term.c b/kern/term.c index e66f353ed..08be7a1ea 100644 --- a/kern/term.c +++ b/kern/term.c @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,40 +13,40 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include +#include +#include +#include +#include /* The list of terminals. */ -static pupa_term_t pupa_term_list; +static grub_term_t grub_term_list; /* The current terminal. */ -static pupa_term_t pupa_cur_term; +static grub_term_t grub_cur_term; /* The amount of lines counted by the pager. */ -static int pupa_more_lines; +static int grub_more_lines; /* If the more pager is active. */ -static int pupa_more; +static int grub_more; void -pupa_term_register (pupa_term_t term) +grub_term_register (grub_term_t term) { - term->next = pupa_term_list; - pupa_term_list = term; + term->next = grub_term_list; + grub_term_list = term; } void -pupa_term_unregister (pupa_term_t term) +grub_term_unregister (grub_term_t term) { - pupa_term_t *p, q; + grub_term_t *p, q; - for (p = &pupa_term_list, q = *p; q; p = &(q->next), q = q->next) + for (p = &grub_term_list, q = *p; q; p = &(q->next), q = q->next) if (q == term) { *p = q->next; @@ -55,83 +55,83 @@ pupa_term_unregister (pupa_term_t term) } void -pupa_term_iterate (int (*hook) (pupa_term_t term)) +grub_term_iterate (int (*hook) (grub_term_t term)) { - pupa_term_t p; + grub_term_t p; - for (p = pupa_term_list; p; p = p->next) + for (p = grub_term_list; p; p = p->next) if (hook (p)) break; } -pupa_err_t -pupa_term_set_current (pupa_term_t term) +grub_err_t +grub_term_set_current (grub_term_t term) { - if (pupa_cur_term && pupa_cur_term->fini) - if ((pupa_cur_term->fini) () != PUPA_ERR_NONE) - return pupa_errno; + if (grub_cur_term && grub_cur_term->fini) + if ((grub_cur_term->fini) () != GRUB_ERR_NONE) + return grub_errno; if (term->init) - if ((term->init) () != PUPA_ERR_NONE) - return pupa_errno; + if ((term->init) () != GRUB_ERR_NONE) + return grub_errno; - pupa_cur_term = term; - pupa_cls (); - return PUPA_ERR_NONE; + grub_cur_term = term; + grub_cls (); + return GRUB_ERR_NONE; } -pupa_term_t -pupa_term_get_current (void) +grub_term_t +grub_term_get_current (void) { - return pupa_cur_term; + return grub_cur_term; } /* Put a Unicode character. */ void -pupa_putcode (pupa_uint32_t code) +grub_putcode (grub_uint32_t code) { - if (code == '\t' && pupa_cur_term->getxy) + if (code == '\t' && grub_cur_term->getxy) { int n; - n = 8 - ((pupa_getxy () >> 8) & 7); + n = 8 - ((grub_getxy () >> 8) & 7); while (n--) - pupa_putcode (' '); + grub_putcode (' '); return; } - (pupa_cur_term->putchar) (code); + (grub_cur_term->putchar) (code); if (code == '\n') { - pupa_putcode ('\r'); + grub_putcode ('\r'); - pupa_more_lines++; + grub_more_lines++; /* XXX: Don't use a fixed height! */ - if (pupa_more && pupa_more_lines == 24 - 1) + if (grub_more && grub_more_lines == 24 - 1) { char key; - int pos = pupa_getxy (); + int pos = grub_getxy (); /* Show --MORE-- on the lower left side of the screen. */ - pupa_gotoxy (1, 24 - 1); - pupa_setcolorstate (PUPA_TERM_COLOR_HIGHLIGHT); - pupa_printf ("--MORE--"); - pupa_setcolorstate (PUPA_TERM_COLOR_STANDARD); + grub_gotoxy (1, 24 - 1); + grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); + grub_printf ("--MORE--"); + grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); - key = pupa_getkey (); + key = grub_getkey (); /* Remove the message. */ - pupa_gotoxy (1, 24 -1); - pupa_printf (" "); - pupa_gotoxy (pos >> 8, pos & 0xFF); + grub_gotoxy (1, 24 -1); + grub_printf (" "); + grub_gotoxy (pos >> 8, pos & 0xFF); /* Scroll one lines or an entire page, depending on the key. */ if (key == '\r' || key =='\n') - pupa_more_lines--; + grub_more_lines--; else - pupa_more_lines = 0; + grub_more_lines = 0; } } } @@ -139,9 +139,9 @@ pupa_putcode (pupa_uint32_t code) /* Put a character. C is one byte of a UTF-8 stream. This function gathers bytes until a valid Unicode character is found. */ void -pupa_putchar (int c) +grub_putchar (int c) { - static pupa_uint32_t code = 0; + static grub_uint32_t code = 0; static int count = 0; if (count) @@ -197,68 +197,68 @@ pupa_putchar (int c) /* Not finished yet. */ return; - pupa_putcode (code); + grub_putcode (code); } int -pupa_getkey (void) +grub_getkey (void) { - return (pupa_cur_term->getkey) (); + return (grub_cur_term->getkey) (); } int -pupa_checkkey (void) +grub_checkkey (void) { - return (pupa_cur_term->checkkey) (); + return (grub_cur_term->checkkey) (); } -pupa_uint16_t -pupa_getxy (void) +grub_uint16_t +grub_getxy (void) { - return (pupa_cur_term->getxy) (); + return (grub_cur_term->getxy) (); } void -pupa_gotoxy (pupa_uint8_t x, pupa_uint8_t y) +grub_gotoxy (grub_uint8_t x, grub_uint8_t y) { - (pupa_cur_term->gotoxy) (x, y); + (grub_cur_term->gotoxy) (x, y); } void -pupa_cls (void) +grub_cls (void) { - if (pupa_cur_term->flags & PUPA_TERM_DUMB) + if (grub_cur_term->flags & GRUB_TERM_DUMB) { - pupa_putchar ('\n'); - pupa_refresh (); + grub_putchar ('\n'); + grub_refresh (); } else - (pupa_cur_term->cls) (); + (grub_cur_term->cls) (); } void -pupa_setcolorstate (pupa_term_color_state state) +grub_setcolorstate (grub_term_color_state state) { - if (pupa_cur_term->setcolorstate) - (pupa_cur_term->setcolorstate) (state); + if (grub_cur_term->setcolorstate) + (grub_cur_term->setcolorstate) (state); } void -pupa_setcolor (pupa_uint8_t normal_color, pupa_uint8_t highlight_color) +grub_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color) { - if (pupa_cur_term->setcolor) - (pupa_cur_term->setcolor) (normal_color, highlight_color); + if (grub_cur_term->setcolor) + (grub_cur_term->setcolor) (normal_color, highlight_color); } int -pupa_setcursor (int on) +grub_setcursor (int on) { static int prev = 1; int ret = prev; - if (pupa_cur_term->setcursor) + if (grub_cur_term->setcursor) { - (pupa_cur_term->setcursor) (on); + (grub_cur_term->setcursor) (on); prev = on; } @@ -266,19 +266,19 @@ pupa_setcursor (int on) } void -pupa_refresh (void) +grub_refresh (void) { - if (pupa_cur_term->refresh) - (pupa_cur_term->refresh) (); + if (grub_cur_term->refresh) + (grub_cur_term->refresh) (); } void -pupa_set_more (int onoff) +grub_set_more (int onoff) { if (onoff == 1) - pupa_more++; + grub_more++; else - pupa_more--; + grub_more--; - pupa_more_lines = 0; + grub_more_lines = 0; } diff --git a/loader/i386/pc/chainloader.c b/loader/i386/pc/chainloader.c index c96e29dd4..dd4390777 100644 --- a/loader/i386/pc/chainloader.c +++ b/loader/i386/pc/chainloader.c @@ -1,6 +1,6 @@ /* chainloader.c - boot another boot loader */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,79 +18,79 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -static pupa_dl_t my_mod; +static grub_dl_t my_mod; -static pupa_err_t -pupa_chainloader_boot (void) +static grub_err_t +grub_chainloader_boot (void) { - pupa_device_t dev; + grub_device_t dev; int drive = -1; void *part_addr = 0; /* Open the root device. */ - dev = pupa_device_open (0); + dev = grub_device_open (0); if (dev) { - pupa_disk_t disk = dev->disk; + grub_disk_t disk = dev->disk; if (disk) { - pupa_partition_t p = disk->partition; + grub_partition_t p = disk->partition; /* In i386-pc, the id is equal to the BIOS drive number. */ drive = (int) disk->id; if (p) { - pupa_disk_read (disk, p->offset, 446, 64, - (char *) PUPA_MEMORY_MACHINE_PART_TABLE_ADDR); + grub_disk_read (disk, p->offset, 446, 64, + (char *) GRUB_MEMORY_MACHINE_PART_TABLE_ADDR); /* Ignore errors. Perhaps it's not fatal. */ - part_addr = (void *) (PUPA_MEMORY_MACHINE_PART_TABLE_ADDR + part_addr = (void *) (GRUB_MEMORY_MACHINE_PART_TABLE_ADDR + (p->index << 4)); } } - pupa_device_close (dev); + grub_device_close (dev); } - pupa_chainloader_real_boot (drive, part_addr); + grub_chainloader_real_boot (drive, part_addr); /* Never reach here. */ - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } -static pupa_err_t -pupa_chainloader_unload (void) +static grub_err_t +grub_chainloader_unload (void) { - pupa_dl_unref (my_mod); - return PUPA_ERR_NONE; + grub_dl_unref (my_mod); + return GRUB_ERR_NONE; } void -pupa_rescue_cmd_chainloader (int argc, char *argv[]) +grub_rescue_cmd_chainloader (int argc, char *argv[]) { - pupa_file_t file = 0; - pupa_uint16_t signature; + grub_file_t file = 0; + grub_uint16_t signature; int force = 0; - pupa_dl_ref (my_mod); + grub_dl_ref (my_mod); - if (argc > 0 && pupa_strcmp (argv[0], "--force") == 0) + if (argc > 0 && grub_strcmp (argv[0], "--force") == 0) { force = 1; argc--; @@ -99,55 +99,55 @@ pupa_rescue_cmd_chainloader (int argc, char *argv[]) if (argc == 0) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "no file specified"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified"); goto fail; } - file = pupa_file_open (argv[0]); + file = grub_file_open (argv[0]); if (! file) goto fail; /* Read the first block. */ - if (pupa_file_read (file, (char *) 0x7C00, PUPA_DISK_SECTOR_SIZE) - != PUPA_DISK_SECTOR_SIZE) + if (grub_file_read (file, (char *) 0x7C00, GRUB_DISK_SECTOR_SIZE) + != GRUB_DISK_SECTOR_SIZE) { - if (pupa_errno == PUPA_ERR_NONE) - pupa_error (PUPA_ERR_BAD_OS, "too small"); + if (grub_errno == GRUB_ERR_NONE) + grub_error (GRUB_ERR_BAD_OS, "too small"); goto fail; } /* Check the signature. */ - signature = *((pupa_uint16_t *) (0x7C00 + PUPA_DISK_SECTOR_SIZE - 2)); - if (signature != pupa_le_to_cpu16 (0xaa55) && ! force) + signature = *((grub_uint16_t *) (0x7C00 + GRUB_DISK_SECTOR_SIZE - 2)); + if (signature != grub_le_to_cpu16 (0xaa55) && ! force) { - pupa_error (PUPA_ERR_BAD_OS, "invalid signature"); + grub_error (GRUB_ERR_BAD_OS, "invalid signature"); goto fail; } - pupa_file_close (file); - pupa_loader_set (pupa_chainloader_boot, pupa_chainloader_unload); + grub_file_close (file); + grub_loader_set (grub_chainloader_boot, grub_chainloader_unload); return; fail: if (file) - pupa_file_close (file); + grub_file_close (file); - pupa_dl_unref (my_mod); + grub_dl_unref (my_mod); } static const char loader_name[] = "chainloader"; -PUPA_MOD_INIT +GRUB_MOD_INIT { - pupa_rescue_register_command (loader_name, - pupa_rescue_cmd_chainloader, + grub_rescue_register_command (loader_name, + grub_rescue_cmd_chainloader, "load another boot loader"); my_mod = mod; } -PUPA_MOD_FINI +GRUB_MOD_FINI { - pupa_rescue_unregister_command (loader_name); + grub_rescue_unregister_command (loader_name); } diff --git a/loader/i386/pc/linux.c b/loader/i386/pc/linux.c index b66137374..5f2276c49 100644 --- a/loader/i386/pc/linux.c +++ b/loader/i386/pc/linux.c @@ -1,6 +1,6 @@ /* linux.c - boot Linux zImage or bzImage */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,90 +18,90 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -static pupa_dl_t my_mod; +static grub_dl_t my_mod; static int big_linux; -static pupa_size_t linux_mem_size; +static grub_size_t linux_mem_size; static int loaded; -static pupa_err_t -pupa_linux_boot (void) +static grub_err_t +grub_linux_boot (void) { if (big_linux) - pupa_linux_boot_bzimage (); + grub_linux_boot_bzimage (); else - pupa_linux_boot_zimage (); + grub_linux_boot_zimage (); /* Never reach here. */ - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } -static pupa_err_t -pupa_linux_unload (void) +static grub_err_t +grub_linux_unload (void) { - pupa_dl_unref (my_mod); + grub_dl_unref (my_mod); loaded = 0; - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } void -pupa_rescue_cmd_linux (int argc, char *argv[]) +grub_rescue_cmd_linux (int argc, char *argv[]) { - pupa_file_t file = 0; + grub_file_t file = 0; struct linux_kernel_header lh; - pupa_uint8_t setup_sects; - pupa_size_t real_size, prot_size; - pupa_ssize_t len; + grub_uint8_t setup_sects; + grub_size_t real_size, prot_size; + grub_ssize_t len; int i; char *dest; - pupa_dl_ref (my_mod); + grub_dl_ref (my_mod); if (argc == 0) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "no kernel specified"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "no kernel specified"); goto fail; } - file = pupa_file_open (argv[0]); + file = grub_file_open (argv[0]); if (! file) goto fail; - if (pupa_file_size (file) > (pupa_ssize_t) pupa_os_area_size) + if (grub_file_size (file) > (grub_ssize_t) grub_os_area_size) { - pupa_error (PUPA_ERR_OUT_OF_RANGE, "too big kernel"); + grub_error (GRUB_ERR_OUT_OF_RANGE, "too big kernel"); goto fail; } - if (pupa_file_read (file, (char *) &lh, sizeof (lh)) != sizeof (lh)) + if (grub_file_read (file, (char *) &lh, sizeof (lh)) != sizeof (lh)) { - pupa_error (PUPA_ERR_READ_ERROR, "cannot read the linux header"); + grub_error (GRUB_ERR_READ_ERROR, "cannot read the linux header"); goto fail; } - if (lh.boot_flag != pupa_cpu_to_le16 (0xaa55)) + if (lh.boot_flag != grub_cpu_to_le16 (0xaa55)) { - pupa_error (PUPA_ERR_BAD_OS, "invalid magic number"); + grub_error (GRUB_ERR_BAD_OS, "invalid magic number"); goto fail; } - if (lh.setup_sects > PUPA_LINUX_MAX_SETUP_SECTS) + if (lh.setup_sects > GRUB_LINUX_MAX_SETUP_SECTS) { - pupa_error (PUPA_ERR_BAD_OS, "too many setup sectors"); + grub_error (GRUB_ERR_BAD_OS, "too many setup sectors"); goto fail; } @@ -109,109 +109,109 @@ pupa_rescue_cmd_linux (int argc, char *argv[]) setup_sects = lh.setup_sects; linux_mem_size = 0; - if (lh.header == pupa_cpu_to_le32 (PUPA_LINUX_MAGIC_SIGNATURE) - && pupa_le_to_cpu16 (lh.version) >= 0x0200) + if (lh.header == grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE) + && grub_le_to_cpu16 (lh.version) >= 0x0200) { - big_linux = (lh.loadflags & PUPA_LINUX_FLAG_BIG_KERNEL); - lh.type_of_loader = PUPA_LINUX_BOOT_LOADER_TYPE; + big_linux = (lh.loadflags & GRUB_LINUX_FLAG_BIG_KERNEL); + lh.type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE; /* Put the real mode part at as a high location as possible. */ - pupa_linux_real_addr = (char *) (pupa_lower_mem - - PUPA_LINUX_SETUP_MOVE_SIZE); + grub_linux_real_addr = (char *) (grub_lower_mem + - GRUB_LINUX_SETUP_MOVE_SIZE); /* But it must not exceed the traditional area. */ - if (pupa_linux_real_addr > (char *) PUPA_LINUX_OLD_REAL_MODE_ADDR) - pupa_linux_real_addr = (char *) PUPA_LINUX_OLD_REAL_MODE_ADDR; + if (grub_linux_real_addr > (char *) GRUB_LINUX_OLD_REAL_MODE_ADDR) + grub_linux_real_addr = (char *) GRUB_LINUX_OLD_REAL_MODE_ADDR; - if (pupa_le_to_cpu16 (lh.version) >= 0x0201) + if (grub_le_to_cpu16 (lh.version) >= 0x0201) { - lh.heap_end_ptr = pupa_cpu_to_le16 (PUPA_LINUX_HEAP_END_OFFSET); - lh.loadflags |= PUPA_LINUX_FLAG_CAN_USE_HEAP; + lh.heap_end_ptr = grub_cpu_to_le16 (GRUB_LINUX_HEAP_END_OFFSET); + lh.loadflags |= GRUB_LINUX_FLAG_CAN_USE_HEAP; } - if (pupa_le_to_cpu16 (lh.version) >= 0x0202) - lh.cmd_line_ptr = pupa_linux_real_addr + PUPA_LINUX_CL_OFFSET; + if (grub_le_to_cpu16 (lh.version) >= 0x0202) + lh.cmd_line_ptr = grub_linux_real_addr + GRUB_LINUX_CL_OFFSET; else { - lh.cl_magic = pupa_cpu_to_le16 (PUPA_LINUX_CL_MAGIC); - lh.cl_offset = pupa_cpu_to_le16 (PUPA_LINUX_CL_OFFSET); - lh.setup_move_size = pupa_cpu_to_le16 (PUPA_LINUX_SETUP_MOVE_SIZE); + lh.cl_magic = grub_cpu_to_le16 (GRUB_LINUX_CL_MAGIC); + lh.cl_offset = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET); + lh.setup_move_size = grub_cpu_to_le16 (GRUB_LINUX_SETUP_MOVE_SIZE); } } else { /* Your kernel is quite old... */ - lh.cl_magic = pupa_cpu_to_le16 (PUPA_LINUX_CL_MAGIC); - lh.cl_offset = pupa_cpu_to_le16 (PUPA_LINUX_CL_OFFSET); + lh.cl_magic = grub_cpu_to_le16 (GRUB_LINUX_CL_MAGIC); + lh.cl_offset = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET); - setup_sects = PUPA_LINUX_DEFAULT_SETUP_SECTS; + setup_sects = GRUB_LINUX_DEFAULT_SETUP_SECTS; - pupa_linux_real_addr = (char *) PUPA_LINUX_OLD_REAL_MODE_ADDR; + grub_linux_real_addr = (char *) GRUB_LINUX_OLD_REAL_MODE_ADDR; } /* If SETUP_SECTS is not set, set it to the default (4). */ if (! setup_sects) - setup_sects = PUPA_LINUX_DEFAULT_SETUP_SECTS; + setup_sects = GRUB_LINUX_DEFAULT_SETUP_SECTS; - real_size = setup_sects << PUPA_DISK_SECTOR_BITS; - prot_size = pupa_file_size (file) - real_size - PUPA_DISK_SECTOR_SIZE; + real_size = setup_sects << GRUB_DISK_SECTOR_BITS; + prot_size = grub_file_size (file) - real_size - GRUB_DISK_SECTOR_SIZE; - pupa_linux_tmp_addr = (char *) PUPA_LINUX_BZIMAGE_ADDR + prot_size; + grub_linux_tmp_addr = (char *) GRUB_LINUX_BZIMAGE_ADDR + prot_size; if (! big_linux - && prot_size > (pupa_size_t) (pupa_linux_real_addr - - (char *) PUPA_LINUX_ZIMAGE_ADDR)) + && prot_size > (grub_size_t) (grub_linux_real_addr + - (char *) GRUB_LINUX_ZIMAGE_ADDR)) { - pupa_error (PUPA_ERR_BAD_OS, "too big zImage, use bzImage instead"); + grub_error (GRUB_ERR_BAD_OS, "too big zImage, use bzImage instead"); goto fail; } - if (pupa_linux_real_addr + PUPA_LINUX_SETUP_MOVE_SIZE - > (char *) pupa_lower_mem) + if (grub_linux_real_addr + GRUB_LINUX_SETUP_MOVE_SIZE + > (char *) grub_lower_mem) { - pupa_error (PUPA_ERR_OUT_OF_RANGE, "too small lower memory"); + grub_error (GRUB_ERR_OUT_OF_RANGE, "too small lower memory"); goto fail; } - pupa_printf (" [Linux-%s, setup=0x%x, size=0x%x]\n", + grub_printf (" [Linux-%s, setup=0x%x, size=0x%x]\n", big_linux ? "bzImage" : "zImage", real_size, prot_size); for (i = 1; i < argc; i++) - if (pupa_memcmp (argv[i], "vga=", 4) == 0) + if (grub_memcmp (argv[i], "vga=", 4) == 0) { /* Video mode selection support. */ - pupa_uint16_t vid_mode; + grub_uint16_t vid_mode; char *val = argv[i] + 4; - if (pupa_strcmp (val, "normal") == 0) - vid_mode = PUPA_LINUX_VID_MODE_NORMAL; - else if (pupa_strcmp (val, "ext") == 0) - vid_mode = PUPA_LINUX_VID_MODE_EXTENDED; - else if (pupa_strcmp (val, "ask") == 0) - vid_mode = PUPA_LINUX_VID_MODE_ASK; + if (grub_strcmp (val, "normal") == 0) + vid_mode = GRUB_LINUX_VID_MODE_NORMAL; + else if (grub_strcmp (val, "ext") == 0) + vid_mode = GRUB_LINUX_VID_MODE_EXTENDED; + else if (grub_strcmp (val, "ask") == 0) + vid_mode = GRUB_LINUX_VID_MODE_ASK; else - vid_mode = (pupa_uint16_t) pupa_strtoul (val, 0, 0); + vid_mode = (grub_uint16_t) grub_strtoul (val, 0, 0); - if (pupa_errno) + if (grub_errno) goto fail; - lh.vid_mode = pupa_cpu_to_le16 (vid_mode); + lh.vid_mode = grub_cpu_to_le16 (vid_mode); } - else if (pupa_memcmp (argv[i], "mem=", 4) == 0) + else if (grub_memcmp (argv[i], "mem=", 4) == 0) { char *val = argv[i] + 4; - linux_mem_size = pupa_strtoul (val, &val, 0); + linux_mem_size = grub_strtoul (val, &val, 0); - if (pupa_errno) + if (grub_errno) { - pupa_errno = PUPA_ERR_NONE; + grub_errno = GRUB_ERR_NONE; linux_mem_size = 0; } else { int shift = 0; - switch (pupa_tolower (val[0])) + switch (grub_tolower (val[0])) { case 'g': shift += 10; @@ -232,33 +232,33 @@ pupa_rescue_cmd_linux (int argc, char *argv[]) } /* Put the real mode code at the temporary address. */ - pupa_memmove (pupa_linux_tmp_addr, &lh, sizeof (lh)); + grub_memmove (grub_linux_tmp_addr, &lh, sizeof (lh)); - len = real_size + PUPA_DISK_SECTOR_SIZE - sizeof (lh); - if (pupa_file_read (file, pupa_linux_tmp_addr + sizeof (lh), len) != len) + len = real_size + GRUB_DISK_SECTOR_SIZE - sizeof (lh); + if (grub_file_read (file, grub_linux_tmp_addr + sizeof (lh), len) != len) { - pupa_error (PUPA_ERR_FILE_READ_ERROR, "Couldn't read file"); + grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file"); goto fail; } - if (lh.header != pupa_cpu_to_le32 (PUPA_LINUX_MAGIC_SIGNATURE) - || pupa_le_to_cpu16 (lh.version) < 0x0200) + if (lh.header != grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE) + || grub_le_to_cpu16 (lh.version) < 0x0200) /* Clear the heap space. */ - pupa_memset (pupa_linux_tmp_addr - + ((setup_sects + 1) << PUPA_DISK_SECTOR_BITS), + grub_memset (grub_linux_tmp_addr + + ((setup_sects + 1) << GRUB_DISK_SECTOR_BITS), 0, - ((PUPA_LINUX_MAX_SETUP_SECTS - setup_sects - 1) - << PUPA_DISK_SECTOR_BITS)); + ((GRUB_LINUX_MAX_SETUP_SECTS - setup_sects - 1) + << GRUB_DISK_SECTOR_BITS)); /* Copy kernel parameters. */ - for (i = 1, dest = pupa_linux_tmp_addr + PUPA_LINUX_CL_OFFSET; + for (i = 1, dest = grub_linux_tmp_addr + GRUB_LINUX_CL_OFFSET; i < argc - && dest + pupa_strlen (argv[i]) < (pupa_linux_tmp_addr - + PUPA_LINUX_CL_END_OFFSET); + && dest + grub_strlen (argv[i]) < (grub_linux_tmp_addr + + GRUB_LINUX_CL_END_OFFSET); i++, *dest++ = ' ') { - pupa_strcpy (dest, argv[i]); - dest += pupa_strlen (argv[i]); + grub_strcpy (dest, argv[i]); + dest += grub_strlen (argv[i]); } if (i != 1) @@ -267,63 +267,63 @@ pupa_rescue_cmd_linux (int argc, char *argv[]) *dest = '\0'; len = prot_size; - if (pupa_file_read (file, (char *) PUPA_LINUX_BZIMAGE_ADDR, len) != len) - pupa_error (PUPA_ERR_FILE_READ_ERROR, "Couldn't read file"); + if (grub_file_read (file, (char *) GRUB_LINUX_BZIMAGE_ADDR, len) != len) + grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file"); - if (pupa_errno == PUPA_ERR_NONE) + if (grub_errno == GRUB_ERR_NONE) { - pupa_linux_prot_size = prot_size; - pupa_loader_set (pupa_linux_boot, pupa_linux_unload); + grub_linux_prot_size = prot_size; + grub_loader_set (grub_linux_boot, grub_linux_unload); loaded = 1; } fail: if (file) - pupa_file_close (file); + grub_file_close (file); - if (pupa_errno != PUPA_ERR_NONE) + if (grub_errno != GRUB_ERR_NONE) { - pupa_dl_unref (my_mod); + grub_dl_unref (my_mod); loaded = 0; } } void -pupa_rescue_cmd_initrd (int argc __attribute__ ((unused)), +grub_rescue_cmd_initrd (int argc __attribute__ ((unused)), char *argv[] __attribute__ ((unused))) { - pupa_file_t file = 0; - pupa_ssize_t size; - pupa_addr_t addr_max, addr_min, addr; + grub_file_t file = 0; + grub_ssize_t size; + grub_addr_t addr_max, addr_min, addr; struct linux_kernel_header *lh; if (argc == 0) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "No module specified"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "No module specified"); goto fail; } if (!loaded) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "You need to load the kernel first."); + grub_error (GRUB_ERR_BAD_ARGUMENT, "You need to load the kernel first."); goto fail; } - lh = (struct linux_kernel_header *) pupa_linux_tmp_addr; + lh = (struct linux_kernel_header *) grub_linux_tmp_addr; - if (!(lh->header == pupa_cpu_to_le32 (PUPA_LINUX_MAGIC_SIGNATURE) - && pupa_le_to_cpu16 (lh->version) >= 0x0200)) + if (!(lh->header == grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE) + && grub_le_to_cpu16 (lh->version) >= 0x0200)) { - pupa_error (PUPA_ERR_BAD_OS, "The kernel is too old for initrd."); + grub_error (GRUB_ERR_BAD_OS, "The kernel is too old for initrd."); goto fail; } /* Get the highest address available for the initrd. */ - if (pupa_le_to_cpu16 (lh->version) >= 0x0203) - addr_max = pupa_cpu_to_le32 (lh->initrd_addr_max); + if (grub_le_to_cpu16 (lh->version) >= 0x0203) + addr_max = grub_cpu_to_le32 (lh->initrd_addr_max); else - addr_max = PUPA_LINUX_INITRD_MAX_ADDRESS; + addr_max = GRUB_LINUX_INITRD_MAX_ADDRESS; if (!linux_mem_size && linux_mem_size < addr_max) addr_max = linux_mem_size; @@ -334,29 +334,29 @@ pupa_rescue_cmd_initrd (int argc __attribute__ ((unused)), worse than that of Linux 2.3.xx, so avoid the last 64kb. */ addr_max -= 0x10000; - if (addr_max > pupa_os_area_addr + pupa_os_area_size) - addr_max = pupa_os_area_addr + pupa_os_area_size; + if (addr_max > grub_os_area_addr + grub_os_area_size) + addr_max = grub_os_area_addr + grub_os_area_size; - addr_min = (pupa_addr_t) pupa_linux_tmp_addr + PUPA_LINUX_CL_END_OFFSET; + addr_min = (grub_addr_t) grub_linux_tmp_addr + GRUB_LINUX_CL_END_OFFSET; - file = pupa_file_open (argv[0]); + file = grub_file_open (argv[0]); if (!file) goto fail; - size = pupa_file_size (file); + size = grub_file_size (file); /* Put the initrd as high as possible, 4Ki aligned. */ addr = (addr_max - size) & ~0xFFF; if (addr < addr_min) { - pupa_error (PUPA_ERR_OUT_OF_RANGE, "The initrd is too big"); + grub_error (GRUB_ERR_OUT_OF_RANGE, "The initrd is too big"); goto fail; } - if (pupa_file_read (file, (void *)addr, size) != size) + if (grub_file_read (file, (void *)addr, size) != size) { - pupa_error (PUPA_ERR_FILE_READ_ERROR, "Couldn't read file"); + grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file"); goto fail; } @@ -365,23 +365,23 @@ pupa_rescue_cmd_initrd (int argc __attribute__ ((unused)), fail: if (file) - pupa_file_close (file); + grub_file_close (file); } -PUPA_MOD_INIT +GRUB_MOD_INIT { - pupa_rescue_register_command ("linux", - pupa_rescue_cmd_linux, + grub_rescue_register_command ("linux", + grub_rescue_cmd_linux, "load linux"); - pupa_rescue_register_command ("initrd", - pupa_rescue_cmd_initrd, + grub_rescue_register_command ("initrd", + grub_rescue_cmd_initrd, "load initrd"); my_mod = mod; } -PUPA_MOD_FINI +GRUB_MOD_FINI { - pupa_rescue_unregister_command ("linux"); - pupa_rescue_unregister_command ("initrd"); + grub_rescue_unregister_command ("linux"); + grub_rescue_unregister_command ("initrd"); } diff --git a/loader/i386/pc/multiboot.c b/loader/i386/pc/multiboot.c index 35398c3b3..de39d7ded 100644 --- a/loader/i386/pc/multiboot.c +++ b/loader/i386/pc/multiboot.c @@ -1,6 +1,6 @@ /* multiboot.c - boot a multiboot OS image. */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003, 2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -31,110 +31,110 @@ * - APM table */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -static pupa_dl_t my_mod; -static struct pupa_multiboot_info *mbi; -static pupa_addr_t entry; +static grub_dl_t my_mod; +static struct grub_multiboot_info *mbi; +static grub_addr_t entry; -static pupa_err_t -pupa_multiboot_boot (void) +static grub_err_t +grub_multiboot_boot (void) { - pupa_multiboot_real_boot (entry, mbi); + grub_multiboot_real_boot (entry, mbi); /* Not reached. */ - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } -static pupa_err_t -pupa_multiboot_unload (void) +static grub_err_t +grub_multiboot_unload (void) { if (mbi) { unsigned int i; for (i = 0; i < mbi->mods_count; i++) { - pupa_free ((void *) - ((struct pupa_mod_list *) mbi->mods_addr)[i].mod_start); - pupa_free ((void *) - ((struct pupa_mod_list *) mbi->mods_addr)[i].cmdline); + grub_free ((void *) + ((struct grub_mod_list *) mbi->mods_addr)[i].mod_start); + grub_free ((void *) + ((struct grub_mod_list *) mbi->mods_addr)[i].cmdline); } - pupa_free ((void *) mbi->mods_addr); - pupa_free ((void *) mbi->cmdline); - pupa_free (mbi); + grub_free ((void *) mbi->mods_addr); + grub_free ((void *) mbi->cmdline); + grub_free (mbi); } mbi = 0; - pupa_dl_unref (my_mod); + grub_dl_unref (my_mod); - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } void -pupa_rescue_cmd_multiboot (int argc, char *argv[]) +grub_rescue_cmd_multiboot (int argc, char *argv[]) { - pupa_file_t file = 0; - char buffer[PUPA_MB_SEARCH], *cmdline = 0, *p; - struct pupa_multiboot_header *header; - pupa_ssize_t len; + grub_file_t file = 0; + char buffer[GRUB_MB_SEARCH], *cmdline = 0, *p; + struct grub_multiboot_header *header; + grub_ssize_t len; int i; Elf32_Ehdr *ehdr; - pupa_dl_ref (my_mod); + grub_dl_ref (my_mod); - pupa_loader_unset(); + grub_loader_unset(); if (argc == 0) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "No kernel specified"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "No kernel specified"); goto fail; } - file = pupa_file_open (argv[0]); + file = grub_file_open (argv[0]); if (!file) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "Couldn't open file"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "Couldn't open file"); goto fail; } - len = pupa_file_read (file, buffer, PUPA_MB_SEARCH); + len = grub_file_read (file, buffer, GRUB_MB_SEARCH); if (len < 32) { - pupa_error (PUPA_ERR_BAD_OS, "File too small"); + grub_error (GRUB_ERR_BAD_OS, "File too small"); goto fail; } /* Look for the multiboot header in the buffer. The header should be at least 12 bytes and aligned on a 4-byte boundary. */ - for (header = (struct pupa_multiboot_header *) buffer; + for (header = (struct grub_multiboot_header *) buffer; ((char *) header <= buffer + len - 12) || (header = 0); - header = (struct pupa_multiboot_header *) ((char *)header + 4)) + header = (struct grub_multiboot_header *) ((char *)header + 4)) { - if (header->magic == PUPA_MB_MAGIC + if (header->magic == GRUB_MB_MAGIC && !(header->magic + header->flags + header->checksum)) break; } if (header == 0) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "No multiboot header found"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "No multiboot header found"); goto fail; } - if (header->flags & PUPA_MB_UNSUPPORTED) + if (header->flags & GRUB_MB_UNSUPPORTED) { - pupa_error (PUPA_ERR_UNKNOWN_OS, "Unsupported flag: 0x%x", header->flags); + grub_error (GRUB_ERR_UNKNOWN_OS, "Unsupported flag: 0x%x", header->flags); goto fail; } @@ -150,14 +150,14 @@ pupa_rescue_cmd_multiboot (int argc, char *argv[]) && (ehdr->e_type == ET_EXEC) && (ehdr->e_machine == EM_386) && (ehdr->e_version == EV_CURRENT))) { - pupa_error (PUPA_ERR_UNKNOWN_OS, "No valid ELF header found"); + grub_error (GRUB_ERR_UNKNOWN_OS, "No valid ELF header found"); goto fail; } /* FIXME: Should we support program headers at strange locations? */ - if (ehdr->e_phoff + ehdr->e_phnum * ehdr->e_phentsize > PUPA_MB_SEARCH) + if (ehdr->e_phoff + ehdr->e_phnum * ehdr->e_phentsize > GRUB_MB_SEARCH) { - pupa_error (PUPA_ERR_UNKNOWN_OS, "Program header at a too high offset"); + grub_error (GRUB_ERR_UNKNOWN_OS, "Program header at a too high offset"); goto fail; } @@ -172,186 +172,186 @@ pupa_rescue_cmd_multiboot (int argc, char *argv[]) if (phdr->p_type == PT_LOAD) { /* The segment should fit in the area reserved for the OS. */ - if ((phdr->p_paddr < pupa_os_area_addr) + if ((phdr->p_paddr < grub_os_area_addr) || (phdr->p_paddr + phdr->p_memsz - > pupa_os_area_addr + pupa_os_area_size)) + > grub_os_area_addr + grub_os_area_size)) { - pupa_error (PUPA_ERR_BAD_OS, + grub_error (GRUB_ERR_BAD_OS, "Segment doesn't fit in memory reserved for the OS"); goto fail; } - if (pupa_file_seek (file, phdr->p_offset) == -1) + if (grub_file_seek (file, phdr->p_offset) == -1) { - pupa_error (PUPA_ERR_BAD_OS, "Invalid offset in program header"); + grub_error (GRUB_ERR_BAD_OS, "Invalid offset in program header"); goto fail; } - if (pupa_file_read (file, (void *) phdr->p_paddr, phdr->p_filesz) - != (pupa_ssize_t) phdr->p_filesz) + if (grub_file_read (file, (void *) phdr->p_paddr, phdr->p_filesz) + != (grub_ssize_t) phdr->p_filesz) { - pupa_error (PUPA_ERR_BAD_OS, "Couldn't read segment from file"); + grub_error (GRUB_ERR_BAD_OS, "Couldn't read segment from file"); goto fail; } if (phdr->p_filesz < phdr->p_memsz) - pupa_memset ((char *) phdr->p_paddr + phdr->p_filesz, 0, + grub_memset ((char *) phdr->p_paddr + phdr->p_filesz, 0, phdr->p_memsz - phdr->p_filesz); } } - mbi = pupa_malloc (sizeof (struct pupa_multiboot_info)); + mbi = grub_malloc (sizeof (struct grub_multiboot_info)); if (!mbi) goto fail; - mbi->flags = PUPA_MB_INFO_MEMORY; + mbi->flags = GRUB_MB_INFO_MEMORY; /* Convert from bytes to kilobytes. */ - mbi->mem_lower = pupa_lower_mem / 1024; - mbi->mem_upper = pupa_upper_mem / 1024; + mbi->mem_lower = grub_lower_mem / 1024; + mbi->mem_upper = grub_upper_mem / 1024; for (i = 0, len = 0; i < argc; i++) - len += pupa_strlen (argv[i]) + 1; + len += grub_strlen (argv[i]) + 1; - cmdline = p = pupa_malloc (len); + cmdline = p = grub_malloc (len); if (!cmdline) goto fail; for (i = 0; i < argc; i++) { - p = pupa_stpcpy (p, argv[i]); + p = grub_stpcpy (p, argv[i]); *(p++) = ' '; } /* Remove the space after the last word. */ *(--p) = '\0'; - mbi->flags |= PUPA_MB_INFO_CMDLINE; - mbi->cmdline = (pupa_uint32_t) cmdline; + mbi->flags |= GRUB_MB_INFO_CMDLINE; + mbi->cmdline = (grub_uint32_t) cmdline; - mbi->flags |= PUPA_MB_INFO_BOOT_LOADER_NAME; - mbi->boot_loader_name = (pupa_uint32_t) pupa_strdup (PACKAGE_STRING); + mbi->flags |= GRUB_MB_INFO_BOOT_LOADER_NAME; + mbi->boot_loader_name = (grub_uint32_t) grub_strdup (PACKAGE_STRING); - pupa_loader_set (pupa_multiboot_boot, pupa_multiboot_unload); + grub_loader_set (grub_multiboot_boot, grub_multiboot_unload); fail: if (file) - pupa_file_close (file); + grub_file_close (file); - if (pupa_errno != PUPA_ERR_NONE) + if (grub_errno != GRUB_ERR_NONE) { - pupa_free (cmdline); - pupa_free (mbi); - pupa_dl_unref (my_mod); + grub_free (cmdline); + grub_free (mbi); + grub_dl_unref (my_mod); } } void -pupa_rescue_cmd_module (int argc, char *argv[]) +grub_rescue_cmd_module (int argc, char *argv[]) { - pupa_file_t file = 0; - pupa_ssize_t size, len = 0; + grub_file_t file = 0; + grub_ssize_t size, len = 0; char *module = 0, *cmdline = 0, *p; int i; if (argc == 0) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "No module specified"); + grub_error (GRUB_ERR_BAD_ARGUMENT, "No module specified"); goto fail; } if (!mbi) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, + grub_error (GRUB_ERR_BAD_ARGUMENT, "You need to load the multiboot kernel first"); goto fail; } - file = pupa_file_open (argv[0]); + file = grub_file_open (argv[0]); if (!file) goto fail; - size = pupa_file_size (file); - module = pupa_memalign (PUPA_MB_MOD_ALIGN, size); + size = grub_file_size (file); + module = grub_memalign (GRUB_MB_MOD_ALIGN, size); if (!module) goto fail; - if (pupa_file_read (file, module, size) != size) + if (grub_file_read (file, module, size) != size) { - pupa_error (PUPA_ERR_FILE_READ_ERROR, "Couldn't read file"); + grub_error (GRUB_ERR_FILE_READ_ERROR, "Couldn't read file"); goto fail; } for (i = 0; i < argc; i++) - len += pupa_strlen (argv[i]) + 1; + len += grub_strlen (argv[i]) + 1; - cmdline = p = pupa_malloc (len); + cmdline = p = grub_malloc (len); if (!cmdline) goto fail; for (i = 0; i < argc; i++) { - p = pupa_stpcpy (p, argv[i]); + p = grub_stpcpy (p, argv[i]); *(p++) = ' '; } /* Remove the space after the last word. */ *(--p) = '\0'; - if (mbi->flags & PUPA_MB_INFO_MODS) + if (mbi->flags & GRUB_MB_INFO_MODS) { - struct pupa_mod_list *modlist = (struct pupa_mod_list *) mbi->mods_addr; + struct grub_mod_list *modlist = (struct grub_mod_list *) mbi->mods_addr; - modlist = pupa_realloc (modlist, (mbi->mods_count + 1) - * sizeof (struct pupa_mod_list)); + modlist = grub_realloc (modlist, (mbi->mods_count + 1) + * sizeof (struct grub_mod_list)); if (!modlist) goto fail; - mbi->mods_addr = (pupa_uint32_t) modlist; + mbi->mods_addr = (grub_uint32_t) modlist; modlist += mbi->mods_count; - modlist->mod_start = (pupa_uint32_t) module; - modlist->mod_end = (pupa_uint32_t) module + size; - modlist->cmdline = (pupa_uint32_t) cmdline; + modlist->mod_start = (grub_uint32_t) module; + modlist->mod_end = (grub_uint32_t) module + size; + modlist->cmdline = (grub_uint32_t) cmdline; modlist->pad = 0; mbi->mods_count++; } else { - struct pupa_mod_list *modlist = pupa_malloc (sizeof (struct pupa_mod_list)); + struct grub_mod_list *modlist = grub_malloc (sizeof (struct grub_mod_list)); if (!modlist) goto fail; - modlist->mod_start = (pupa_uint32_t) module; - modlist->mod_end = (pupa_uint32_t) module + size; - modlist->cmdline = (pupa_uint32_t) cmdline; + modlist->mod_start = (grub_uint32_t) module; + modlist->mod_end = (grub_uint32_t) module + size; + modlist->cmdline = (grub_uint32_t) cmdline; modlist->pad = 0; mbi->mods_count = 1; - mbi->mods_addr = (pupa_uint32_t) modlist; - mbi->flags |= PUPA_MB_INFO_MODS; + mbi->mods_addr = (grub_uint32_t) modlist; + mbi->flags |= GRUB_MB_INFO_MODS; } fail: if (file) - pupa_file_close (file); + grub_file_close (file); - if (pupa_errno != PUPA_ERR_NONE) + if (grub_errno != GRUB_ERR_NONE) { - pupa_free (module); - pupa_free (cmdline); + grub_free (module); + grub_free (cmdline); } } -PUPA_MOD_INIT +GRUB_MOD_INIT { - pupa_rescue_register_command ("multiboot", pupa_rescue_cmd_multiboot, + grub_rescue_register_command ("multiboot", grub_rescue_cmd_multiboot, "load a multiboot kernel"); - pupa_rescue_register_command ("module", pupa_rescue_cmd_module, + grub_rescue_register_command ("module", grub_rescue_cmd_module, "load a multiboot module"); my_mod = mod; } -PUPA_MOD_FINI +GRUB_MOD_FINI { - pupa_rescue_unregister_command ("multiboot"); - pupa_rescue_unregister_command ("module"); + grub_rescue_unregister_command ("multiboot"); + grub_rescue_unregister_command ("module"); } diff --git a/normal/arg.c b/normal/arg.c index 01ad717df..11d9686c2 100644 --- a/normal/arg.c +++ b/normal/arg.c @@ -1,9 +1,9 @@ /* arg.c - argument parser */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003, 2004 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,36 +14,36 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "pupa/arg.h" -#include "pupa/misc.h" -#include "pupa/mm.h" -#include "pupa/err.h" -#include "pupa/normal.h" +#include "grub/arg.h" +#include "grub/misc.h" +#include "grub/mm.h" +#include "grub/err.h" +#include "grub/normal.h" /* Build in parser for default options. */ -static const struct pupa_arg_option help_options[] = +static const struct grub_arg_option help_options[] = { {"help", 'h', 0, "Display help", 0, ARG_TYPE_NONE}, {"usage", 'u', 0, "Show how to use this command", 0, ARG_TYPE_NONE}, {0, 0, 0, 0, 0, 0} }; -static struct pupa_arg_option * -find_short (const struct pupa_arg_option *options, char c) +static struct grub_arg_option * +find_short (const struct grub_arg_option *options, char c) { - struct pupa_arg_option *found = 0; - auto struct pupa_arg_option *fnd_short (const struct pupa_arg_option *opt); + struct grub_arg_option *found = 0; + auto struct grub_arg_option *fnd_short (const struct grub_arg_option *opt); - struct pupa_arg_option *fnd_short (const struct pupa_arg_option *opt) + struct grub_arg_option *fnd_short (const struct grub_arg_option *opt) { while (opt->doc) { if (opt->shortarg == c) - return (struct pupa_arg_option *) opt; + return (struct grub_arg_option *) opt; opt++; } return 0; @@ -60,7 +60,7 @@ find_short (const struct pupa_arg_option *options, char c) static char * find_long_option (char *s) { - char *argpos = pupa_strchr (s, '='); + char *argpos = grub_strchr (s, '='); if (argpos) { @@ -70,18 +70,18 @@ find_long_option (char *s) return 0; } -static struct pupa_arg_option * -find_long (const struct pupa_arg_option *options, char *s) +static struct grub_arg_option * +find_long (const struct grub_arg_option *options, char *s) { - struct pupa_arg_option *found = 0; - auto struct pupa_arg_option *fnd_long (const struct pupa_arg_option *opt); + struct grub_arg_option *found = 0; + auto struct grub_arg_option *fnd_long (const struct grub_arg_option *opt); - struct pupa_arg_option *fnd_long (const struct pupa_arg_option *opt) + struct grub_arg_option *fnd_long (const struct grub_arg_option *opt) { while (opt->doc) { - if (opt->longarg && !pupa_strcmp (opt->longarg, s)) - return (struct pupa_arg_option *) opt; + if (opt->longarg && !grub_strcmp (opt->longarg, s)) + return (struct grub_arg_option *) opt; opt++; } return 0; @@ -96,46 +96,46 @@ find_long (const struct pupa_arg_option *options, char *s) } static void -show_usage (pupa_command_t cmd) +show_usage (grub_command_t cmd) { - pupa_printf ("Usage: %s\n", cmd->summary); + grub_printf ("Usage: %s\n", cmd->summary); } static void -show_help (pupa_command_t cmd) +show_help (grub_command_t cmd) { - static void showargs (const struct pupa_arg_option *opt) + static void showargs (const struct grub_arg_option *opt) { for (; opt->doc; opt++) { - if (opt->shortarg && pupa_isgraph (opt->shortarg)) - pupa_printf ("-%c%c ", opt->shortarg, opt->longarg ? ',':' '); + if (opt->shortarg && grub_isgraph (opt->shortarg)) + grub_printf ("-%c%c ", opt->shortarg, opt->longarg ? ',':' '); else - pupa_printf (" "); + grub_printf (" "); if (opt->longarg) { - pupa_printf ("--%s", opt->longarg); + grub_printf ("--%s", opt->longarg); if (opt->arg) - pupa_printf ("=%s", opt->arg); + grub_printf ("=%s", opt->arg); } else - pupa_printf ("\t"); + grub_printf ("\t"); - pupa_printf ("\t\t%s\n", opt->doc); + grub_printf ("\t\t%s\n", opt->doc); } } show_usage (cmd); - pupa_printf ("%s\n\n", cmd->description); + grub_printf ("%s\n\n", cmd->description); if (cmd->options) showargs (cmd->options); showargs (help_options); - pupa_printf ("\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT); + grub_printf ("\nReport bugs to <%s>.\n", PACKAGE_BUGREPORT); } static int -parse_option (pupa_command_t cmd, int key, char *arg, struct pupa_arg_list *usr) +parse_option (grub_command_t cmd, int key, char *arg, struct grub_arg_list *usr) { switch (key) { @@ -151,7 +151,7 @@ parse_option (pupa_command_t cmd, int key, char *arg, struct pupa_arg_list *usr) { int found = -1; int i = 0; - const struct pupa_arg_option *opt = cmd->options; + const struct grub_arg_option *opt = cmd->options; while (opt->doc) { @@ -176,21 +176,21 @@ parse_option (pupa_command_t cmd, int key, char *arg, struct pupa_arg_list *usr) } int -pupa_arg_parse (pupa_command_t cmd, int argc, char **argv, - struct pupa_arg_list *usr, char ***args, int *argnum) +grub_arg_parse (grub_command_t cmd, int argc, char **argv, + struct grub_arg_list *usr, char ***args, int *argnum) { int curarg; char *longarg = 0; int complete = 0; char **argl = 0; int num = 0; - auto pupa_err_t add_arg (char *s); + auto grub_err_t add_arg (char *s); - pupa_err_t add_arg (char *s) + grub_err_t add_arg (char *s) { - argl = pupa_realloc (argl, (++num) * sizeof (char *)); + argl = grub_realloc (argl, (++num) * sizeof (char *)); if (! args) - return pupa_errno; + return grub_errno; argl[num - 1] = s; return 0; } @@ -199,11 +199,11 @@ pupa_arg_parse (pupa_command_t cmd, int argc, char **argv, for (curarg = 0; curarg < argc; curarg++) { char *arg = argv[curarg]; - struct pupa_arg_option *opt; + struct grub_arg_option *opt; char *option = 0; /* No option is used. */ - if (arg[0] != '-' || pupa_strlen (arg) == 1) + if (arg[0] != '-' || grub_strlen (arg) == 1) { if (add_arg (arg) != 0) goto fail; @@ -221,7 +221,7 @@ pupa_arg_parse (pupa_command_t cmd, int argc, char **argv, opt = find_short (cmd->options, *curshort); if (!opt) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, + grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown argument `-%c'\n", *curshort); goto fail; } @@ -232,7 +232,7 @@ pupa_arg_parse (pupa_command_t cmd, int argc, char **argv, it can have an argument value. */ if (*curshort) { - if (parse_option (cmd, opt->shortarg, 0, usr) || pupa_errno) + if (parse_option (cmd, opt->shortarg, 0, usr) || grub_errno) goto fail; } else @@ -242,8 +242,8 @@ pupa_arg_parse (pupa_command_t cmd, int argc, char **argv, if (curarg + 1 < argc) { char *nextarg = argv[curarg + 1]; - if (!(opt->flags & PUPA_ARG_OPTION_OPTIONAL) - || (pupa_strlen (nextarg) < 2 || nextarg[0] != '-')) + if (!(opt->flags & GRUB_ARG_OPTION_OPTIONAL) + || (grub_strlen (nextarg) < 2 || nextarg[0] != '-')) option = argv[++curarg]; } } @@ -256,7 +256,7 @@ pupa_arg_parse (pupa_command_t cmd, int argc, char **argv, { /* If the argument "--" is used just pass the other arguments. */ - if (pupa_strlen (arg) == 2) + if (grub_strlen (arg) == 2) { for (curarg++; curarg < argc; curarg++) if (add_arg (arg) != 0) @@ -264,7 +264,7 @@ pupa_arg_parse (pupa_command_t cmd, int argc, char **argv, break; } - longarg = (char *) pupa_strdup (arg); + longarg = (char *) grub_strdup (arg); if (! longarg) goto fail; @@ -274,17 +274,17 @@ pupa_arg_parse (pupa_command_t cmd, int argc, char **argv, opt = find_long (cmd->options, arg + 2); if (!opt) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "Unknown argument `%s'\n", arg); + grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown argument `%s'\n", arg); goto fail; } } if (! (opt->type == ARG_TYPE_NONE - || (!option && (opt->flags & PUPA_ARG_OPTION_OPTIONAL)))) + || (!option && (opt->flags & GRUB_ARG_OPTION_OPTIONAL)))) { if (!option) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, + grub_error (GRUB_ERR_BAD_ARGUMENT, "Missing mandatory option for `%s'\n", opt->longarg); goto fail; } @@ -303,10 +303,10 @@ pupa_arg_parse (pupa_command_t cmd, int argc, char **argv, { char *tail; - pupa_strtoul (option, &tail, 0); - if (tail == 0 || tail == option || *tail != '\0' || pupa_errno) + grub_strtoul (option, &tail, 0); + if (tail == 0 || tail == option || *tail != '\0' || grub_errno) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, + grub_error (GRUB_ERR_BAD_ARGUMENT, "The argument `%s' requires an integer.", arg); @@ -322,23 +322,23 @@ pupa_arg_parse (pupa_command_t cmd, int argc, char **argv, /* XXX: Not implemented. */ break; } - if (parse_option (cmd, opt->shortarg, option, usr) || pupa_errno) + if (parse_option (cmd, opt->shortarg, option, usr) || grub_errno) goto fail; } else { if (option) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, + grub_error (GRUB_ERR_BAD_ARGUMENT, "A value was assigned to the argument `%s' while it " "doesn't require an argument\n", arg); goto fail; } - if (parse_option (cmd, opt->shortarg, 0, usr) || pupa_errno) + if (parse_option (cmd, opt->shortarg, 0, usr) || grub_errno) goto fail; } - pupa_free (longarg); + grub_free (longarg); longarg = 0; } @@ -348,7 +348,7 @@ pupa_arg_parse (pupa_command_t cmd, int argc, char **argv, *argnum = num; fail: - pupa_free (longarg); + grub_free (longarg); return complete; } diff --git a/normal/cmdline.c b/normal/cmdline.c index 894f11963..b4d2a16f3 100644 --- a/normal/cmdline.c +++ b/normal/cmdline.c @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,16 +17,16 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static char *kill_buf; @@ -36,11 +36,11 @@ static int hist_pos = 0; static int hist_end = 0; static int hist_used = 0; -pupa_err_t -pupa_set_history (int newsize) +grub_err_t +grub_set_history (int newsize) { char **old_hist_lines = hist_lines; - hist_lines = pupa_malloc (sizeof (char *) * newsize); + hist_lines = grub_malloc (sizeof (char *) * newsize); /* Copy the old lines into the new buffer. */ if (old_hist_lines) @@ -57,7 +57,7 @@ pupa_set_history (int newsize) int pos = hist_end - i; if (pos > hist_size) pos -= hist_size; - pupa_free (old_hist_lines[pos]); + grub_free (old_hist_lines[pos]); } hist_end -= delsize; @@ -66,23 +66,23 @@ pupa_set_history (int newsize) } if (hist_pos < hist_end) - pupa_memmove (hist_lines, old_hist_lines + hist_pos, + grub_memmove (hist_lines, old_hist_lines + hist_pos, (hist_end - hist_pos) * sizeof (char *)); else { /* Copy the first part. */ - pupa_memmove (hist_lines, old_hist_lines, + grub_memmove (hist_lines, old_hist_lines, hist_pos * sizeof (char *)); /* Copy the last part. */ - pupa_memmove (hist_lines + hist_pos, old_hist_lines + hist_pos, + grub_memmove (hist_lines + hist_pos, old_hist_lines + hist_pos, (hist_size - hist_pos) * sizeof (char *)); } } - pupa_free (old_hist_lines); + grub_free (old_hist_lines); hist_size = newsize; hist_pos = 0; @@ -93,7 +93,7 @@ pupa_set_history (int newsize) /* Get the entry POS from the history where `0' is the newest entry. */ static char * -pupa_history_get (int pos) +grub_history_get (int pos) { pos = (hist_pos + pos) % hist_size; return hist_lines[pos]; @@ -102,7 +102,7 @@ pupa_history_get (int pos) /* Insert a new history line S on the top of the history. */ static void -pupa_history_add (char *s) +grub_history_add (char *s) { /* Remove the oldest entry in the history to make room for a new entry. */ @@ -112,7 +112,7 @@ pupa_history_add (char *s) if (hist_end < 0) hist_end = hist_size + hist_end; - pupa_free (hist_lines[hist_end]); + grub_free (hist_lines[hist_end]); } else hist_used++; @@ -123,16 +123,16 @@ pupa_history_add (char *s) hist_pos = hist_size + hist_pos; /* Insert into history. */ - hist_lines[hist_pos] = pupa_strdup (s); + hist_lines[hist_pos] = grub_strdup (s); } /* Replace the history entry on position POS with the string S. */ static void -pupa_history_replace (int pos, char *s) +grub_history_replace (int pos, char *s) { pos = (hist_pos + pos) % hist_size; - pupa_free (hist_lines[pos]); - hist_lines[pos] = pupa_strdup (s); + grub_free (hist_lines[pos]); + hist_lines[pos] = grub_strdup (s); } /* Try to complete the string in BUF, return the characters that @@ -140,7 +140,7 @@ pupa_history_replace (int pos, char *s) completions, in that case set RESTORE to 1 so the caller can restore the prompt. */ static char * -pupa_tab_complete (char *buf, int *restore) +grub_tab_complete (char *buf, int *restore) { char *pos = buf; char *path; @@ -151,8 +151,8 @@ pupa_tab_complete (char *buf, int *restore) int len; int numfound = 0; - /* The disk that is used for pupa_partition_iterate. */ - pupa_device_t partdev; + /* The disk that is used for grub_partition_iterate. */ + grub_device_t partdev; /* String that is added when matched. */ char *matchstr; @@ -162,22 +162,22 @@ pupa_tab_complete (char *buf, int *restore) auto int NESTED_FUNC_ATTR add_completion (const char *comp, const char *match, const char *what, void (*print_completion) (char *)); - auto int iterate_commands (pupa_command_t cmd); + auto int iterate_commands (grub_command_t cmd); auto int iterate_dev (const char *devname); - auto int iterate_part (const pupa_partition_t p); + auto int iterate_part (const grub_partition_t p); auto int iterate_dir (const char *filename, int dir); void print_simple_completion (char *comp) { - pupa_printf (" %s", comp); + grub_printf (" %s", comp); } void print_partition_completion (char *comp) { - pupa_print_partinfo (partdev, comp); - pupa_errno = 0; + grub_print_partinfo (partdev, comp); + grub_errno = 0; } /* Add a string to the list of possible completions. COMP is the @@ -193,21 +193,21 @@ pupa_tab_complete (char *buf, int *restore) void (*print_completion) (char *)) { /* Bug in strncmp then len ==0. */ - if (!len || pupa_strncmp (pos, comp, len) == 0) + if (!len || grub_strncmp (pos, comp, len) == 0) { numfound++; if (numfound == 1) { begin = len; - found = pupa_strdup (comp); - end = pupa_strlen (found); + found = grub_strdup (comp); + end = grub_strlen (found); matchstr = (char *) match; } /* Multiple matches found, print the first instead of completing. */ else if (numfound == 2) { - pupa_printf ("\nPossible %s are: ", what); + grub_printf ("\nPossible %s are: ", what); print_completion (found); } @@ -233,9 +233,9 @@ pupa_tab_complete (char *buf, int *restore) return 0; } - int iterate_part (const pupa_partition_t p) + int iterate_part (const grub_partition_t p) { - add_completion (pupa_partition_get_name (p), ")", "partitions", + add_completion (grub_partition_get_name (p), ")", "partitions", print_partition_completion); return 0; } @@ -246,9 +246,9 @@ pupa_tab_complete (char *buf, int *restore) add_completion (filename, " ", "files", print_simple_completion); else { - char fname[pupa_strlen (filename) + 2]; - pupa_strcpy (fname, filename); - pupa_sprintf (fname, "%s/", filename); + char fname[grub_strlen (filename) + 2]; + grub_strcpy (fname, filename); + grub_sprintf (fname, "%s/", filename); add_completion (fname, "", "files", print_simple_completion); } return 0; @@ -256,10 +256,10 @@ pupa_tab_complete (char *buf, int *restore) int iterate_dev (const char *devname) { - pupa_device_t dev; + grub_device_t dev; /* Complete the partition part. */ - dev = pupa_device_open (devname); + dev = grub_device_open (devname); if (dev) { @@ -269,13 +269,13 @@ pupa_tab_complete (char *buf, int *restore) add_completion (devname, ")", "disks", print_simple_completion); } - pupa_errno = PUPA_ERR_NONE; + grub_errno = GRUB_ERR_NONE; return 0; } - int iterate_commands (pupa_command_t cmd) + int iterate_commands (grub_command_t cmd) { - if (cmd->flags & PUPA_COMMAND_FLAG_CMDLINE) + if (cmd->flags & GRUB_COMMAND_FLAG_CMDLINE) add_completion (cmd->name, " ", "commands", print_simple_completion); return 0; } @@ -285,14 +285,14 @@ pupa_tab_complete (char *buf, int *restore) pos++; /* Check if the string is a command or path. */ - path = pupa_strchr (pos, ' '); + path = grub_strchr (pos, ' '); if (!path) { /* Tab complete a command. */ - len = pupa_strlen (pos); + len = grub_strlen (pos); - pupa_iterate_commands (iterate_commands); + grub_iterate_commands (iterate_commands); } else { @@ -303,17 +303,17 @@ pupa_tab_complete (char *buf, int *restore) pos++; /* Check if this is a completion for a device name. */ - if (*pos == '(' && !pupa_strchr (pos, ')')) + if (*pos == '(' && !grub_strchr (pos, ')')) { /* Check if this is a device or partition. */ - char *partition = pupa_strchr (++pos, ','); + char *partition = grub_strchr (++pos, ','); if (!partition) { /* Complete the disk part. */ - len = pupa_strlen (pos); - pupa_disk_dev_iterate (iterate_dev); - if (pupa_errno) + len = grub_strlen (pos); + grub_disk_dev_iterate (iterate_dev); + if (grub_errno) goto fail; } else @@ -321,23 +321,23 @@ pupa_tab_complete (char *buf, int *restore) *partition = '\0'; /* Complete the partition part. */ - partdev = pupa_device_open (pos); + partdev = grub_device_open (pos); *partition = ','; - pupa_errno = PUPA_ERR_NONE; + grub_errno = GRUB_ERR_NONE; if (partdev) { if (partdev->disk && partdev->disk->has_partitions) { pos = partition + 1; - len = pupa_strlen (pos); + len = grub_strlen (pos); - pupa_partition_iterate (partdev->disk, iterate_part); - if (pupa_errno) - pupa_errno = 0; + grub_partition_iterate (partdev->disk, iterate_part); + if (grub_errno) + grub_errno = 0; } - pupa_device_close (partdev); + grub_device_close (partdev); } else goto fail; @@ -345,53 +345,53 @@ pupa_tab_complete (char *buf, int *restore) } else { - char *device = pupa_file_get_device_name (pos); - pupa_device_t dev; - pupa_fs_t fs; + char *device = grub_file_get_device_name (pos); + grub_device_t dev; + grub_fs_t fs; - dev = pupa_device_open (device); + dev = grub_device_open (device); if (!dev) goto fail; - fs = pupa_fs_probe (dev); - if (pupa_errno) + fs = grub_fs_probe (dev); + if (grub_errno) goto fail; - pos = pupa_strrchr (pos, '/'); + pos = grub_strrchr (pos, '/'); if (pos) { char *dir; char *dirfile; pos++; - len = pupa_strlen (pos); + len = grub_strlen (pos); - dir = pupa_strchr (path, '/'); + dir = grub_strchr (path, '/'); if (!dir) { *restore = 0; return 0; } - dir = pupa_strdup (dir); + dir = grub_strdup (dir); /* Cut away the filename part. */ - dirfile = pupa_strrchr (dir, '/'); + dirfile = grub_strrchr (dir, '/'); dirfile[1] = '\0'; /* Tab complete a file. */ (fs->dir) (dev, dir, iterate_dir); if (dev) - pupa_device_close (dev); + grub_device_close (dev); - pupa_free (device); - pupa_free (dir); + grub_free (device); + grub_free (dir); - if (pupa_errno) + if (grub_errno) goto fail; } else { - found = pupa_strdup ("/"); + found = grub_strdup ("/"); matchstr = ""; numfound = 1; begin = 0; @@ -412,29 +412,29 @@ pupa_tab_complete (char *buf, int *restore) if (end && found) { char *insert; - insert = pupa_malloc (end - begin + 1 + sizeof (matchstr)); - pupa_strncpy (insert, found + begin, end - begin); + insert = grub_malloc (end - begin + 1 + sizeof (matchstr)); + grub_strncpy (insert, found + begin, end - begin); insert[end - begin] = '\0'; if (numfound == 1) - pupa_strcat (insert, matchstr); - pupa_free (found); + grub_strcat (insert, matchstr); + grub_free (found); return insert; } fail: - pupa_free (found); - pupa_errno = PUPA_ERR_NONE; + grub_free (found); + grub_errno = GRUB_ERR_NONE; return 0; } void -pupa_cmdline_run (int nested) +grub_cmdline_run (int nested) { - pupa_normal_init_page (); + grub_normal_init_page (); - pupa_printf ("\ + grub_printf ("\ [ Minimal BASH-like line editing is supported. For the first word, TAB\n\ lists possible command completions. Anywhere else TAB lists possible\n\ device/file completions.%s ]\n\n", @@ -442,20 +442,20 @@ pupa_cmdline_run (int nested) while (1) { - static char cmdline[PUPA_MAX_CMDLINE]; + static char cmdline[GRUB_MAX_CMDLINE]; - pupa_print_error (); - pupa_errno = PUPA_ERR_NONE; + grub_print_error (); + grub_errno = GRUB_ERR_NONE; cmdline[0] = '\0'; - if (! pupa_cmdline_get ("pupa> ", cmdline, sizeof (cmdline), 0, 1) + if (! grub_cmdline_get ("grub> ", cmdline, sizeof (cmdline), 0, 1) && nested) return; if (! *cmdline) continue; - pupa_command_execute (cmdline); + grub_command_execute (cmdline); } } @@ -464,12 +464,12 @@ pupa_cmdline_run (int nested) available. If ESC is pushed, return non-zero, otherwise return zero. */ /* FIXME: The dumb interface is not supported yet. */ int -pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, +grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, int echo_char, int readline) { unsigned xpos, ypos, ystart; - pupa_size_t lpos, llen; - pupa_size_t plen; + grub_size_t lpos, llen; + grub_size_t plen; char buf[max_len]; int key; int histpos = 0; @@ -482,7 +482,7 @@ pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, { xpos = (plen + lpos) % 79; ypos = ystart + (plen + lpos) / 79; - pupa_gotoxy (xpos, ypos); + grub_gotoxy (xpos, ypos); } void cl_print (int pos, int c) @@ -493,30 +493,30 @@ pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, { if (xpos++ > 78) { - pupa_putchar ('\n'); + grub_putchar ('\n'); xpos = 1; - if (ypos == (unsigned) (pupa_getxy () & 0xFF)) + if (ypos == (unsigned) (grub_getxy () & 0xFF)) ystart--; else ypos++; } if (c) - pupa_putchar (c); + grub_putchar (c); else - pupa_putchar (*p); + grub_putchar (*p); } } void cl_insert (const char *str) { - pupa_size_t len = pupa_strlen (str); + grub_size_t len = grub_strlen (str); if (len + llen < max_len) { - pupa_memmove (buf + lpos + len, buf + lpos, llen - lpos + 1); - pupa_memmove (buf + lpos, str, len); + grub_memmove (buf + lpos + len, buf + lpos, llen - lpos + 1); + grub_memmove (buf + lpos, str, len); llen += len; lpos += len; @@ -529,7 +529,7 @@ pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, { if (lpos + len <= llen) { - pupa_size_t saved_lpos = lpos; + grub_size_t saved_lpos = lpos; lpos = llen - len; cl_set_pos (); @@ -537,30 +537,30 @@ pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, lpos = saved_lpos; cl_set_pos (); - pupa_memmove (buf + lpos, buf + lpos + len, llen - lpos + 1); + grub_memmove (buf + lpos, buf + lpos + len, llen - lpos + 1); llen -= len; cl_print (lpos, echo_char); cl_set_pos (); } } - plen = pupa_strlen (prompt); + plen = grub_strlen (prompt); lpos = llen = 0; buf[0] = '\0'; - if ((pupa_getxy () >> 8) != 0) - pupa_putchar ('\n'); + if ((grub_getxy () >> 8) != 0) + grub_putchar ('\n'); - pupa_printf (prompt); + grub_printf (prompt); xpos = plen; - ystart = ypos = (pupa_getxy () & 0xFF); + ystart = ypos = (grub_getxy () & 0xFF); cl_insert (cmdline); - pupa_history_add (buf); + grub_history_add (buf); - while ((key = PUPA_TERM_ASCII_CHAR (pupa_getkey ())) != '\n' && key != '\r') + while ((key = GRUB_TERM_ASCII_CHAR (grub_getkey ())) != '\n' && key != '\r') { if (readline) { @@ -603,22 +603,22 @@ pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, buf[lpos] = '\0'; - insert = pupa_tab_complete (buf, &restore); + insert = grub_tab_complete (buf, &restore); /* Restore the original string. */ buf[lpos] = backup; if (restore) { /* Restore the prompt. */ - pupa_printf ("\n%s%s", prompt, buf); + grub_printf ("\n%s%s", prompt, buf); xpos = plen; - ystart = ypos = (pupa_getxy () & 0xFF); + ystart = ypos = (grub_getxy () & 0xFF); } if (insert) { cl_insert (insert); - pupa_free (insert); + grub_free (insert); } } break; @@ -627,10 +627,10 @@ pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, if (lpos < llen) { if (kill_buf) - pupa_free (kill_buf); + grub_free (kill_buf); - kill_buf = pupa_strdup (buf + lpos); - pupa_errno = PUPA_ERR_NONE; + kill_buf = grub_strdup (buf + lpos); + grub_errno = GRUB_ERR_NONE; cl_delete (llen - lpos); } @@ -646,7 +646,7 @@ pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, histpos--; cl_delete (llen); - hist = pupa_history_get (histpos); + hist = grub_history_get (histpos); cl_insert (hist); break; @@ -661,7 +661,7 @@ pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, histpos++; cl_delete (llen); - hist = pupa_history_get (histpos); + hist = grub_history_get (histpos); cl_insert (hist); } @@ -670,16 +670,16 @@ pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, case 21: /* Ctrl-u */ if (lpos > 0) { - pupa_size_t n = lpos; + grub_size_t n = lpos; if (kill_buf) - pupa_free (kill_buf); + grub_free (kill_buf); - kill_buf = pupa_malloc (n + 1); - pupa_errno = PUPA_ERR_NONE; + kill_buf = grub_malloc (n + 1); + grub_errno = GRUB_ERR_NONE; if (kill_buf) { - pupa_memcpy (kill_buf, buf, n); + grub_memcpy (kill_buf, buf, n); kill_buf[n] = '\0'; } @@ -715,7 +715,7 @@ pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, break; default: - if (pupa_isprint (key)) + if (grub_isprint (key)) { char str[2]; @@ -726,11 +726,11 @@ pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, break; } - pupa_history_replace (histpos, buf); + grub_history_replace (histpos, buf); } - pupa_putchar ('\n'); - pupa_refresh (); + grub_putchar ('\n'); + grub_refresh (); /* If ECHO_CHAR is NUL, remove leading spaces. */ lpos = 0; @@ -738,7 +738,7 @@ pupa_cmdline_get (const char *prompt, char cmdline[], unsigned max_len, while (buf[lpos] == ' ') lpos++; - pupa_memcpy (cmdline, buf + lpos, llen - lpos + 1); + grub_memcpy (cmdline, buf + lpos, llen - lpos + 1); return 1; } diff --git a/normal/command.c b/normal/command.c index a75f0c468..d26392759 100644 --- a/normal/command.c +++ b/normal/command.c @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,28 +17,28 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include -static pupa_command_t pupa_command_list; +static grub_command_t grub_command_list; void -pupa_register_command (const char *name, - pupa_err_t (*func) (struct pupa_arg_list *state, +grub_register_command (const char *name, + grub_err_t (*func) (struct grub_arg_list *state, int argc, char **args), unsigned flags, const char *summary, const char *description, - const struct pupa_arg_option *options) + const struct grub_arg_option *options) { - pupa_command_t cmd, *p; + grub_command_t cmd, *p; - cmd = (pupa_command_t) pupa_malloc (sizeof (*cmd)); + cmd = (grub_command_t) grub_malloc (sizeof (*cmd)); if (! cmd) return; @@ -50,10 +50,10 @@ pupa_register_command (const char *name, cmd->options = options; /* Keep the list sorted for simplicity. */ - p = &pupa_command_list; + p = &grub_command_list; while (*p) { - if (pupa_strcmp ((*p)->name, name) > 0) + if (grub_strcmp ((*p)->name, name) > 0) break; p = &((*p)->next); @@ -64,35 +64,35 @@ pupa_register_command (const char *name, } void -pupa_unregister_command (const char *name) +grub_unregister_command (const char *name) { - pupa_command_t *p, q; + grub_command_t *p, q; - for (p = &pupa_command_list, q = *p; q; p = &(q->next), q = q->next) - if (pupa_strcmp (name, q->name) == 0) + for (p = &grub_command_list, q = *p; q; p = &(q->next), q = q->next) + if (grub_strcmp (name, q->name) == 0) { *p = q->next; - pupa_free (q); + grub_free (q); break; } } -pupa_command_t -pupa_command_find (char *cmdline) +grub_command_t +grub_command_find (char *cmdline) { char *first_space; - pupa_command_t cmd; + grub_command_t cmd; - first_space = pupa_strchr (cmdline, ' '); + first_space = grub_strchr (cmdline, ' '); if (first_space) *first_space = '\0'; - for (cmd = pupa_command_list; cmd; cmd = cmd->next) - if (pupa_strcmp (cmdline, cmd->name) == 0) + for (cmd = grub_command_list; cmd; cmd = cmd->next) + if (grub_strcmp (cmdline, cmd->name) == 0) break; if (! cmd) - pupa_error (PUPA_ERR_UNKNOWN_COMMAND, "unknown command `%s'", cmdline); + grub_error (GRUB_ERR_UNKNOWN_COMMAND, "unknown command `%s'", cmdline); if (first_space) *first_space = ' '; @@ -101,226 +101,226 @@ pupa_command_find (char *cmdline) } int -pupa_iterate_commands (int (*iterate) (pupa_command_t)) +grub_iterate_commands (int (*iterate) (grub_command_t)) { - pupa_command_t cmd; - for (cmd = pupa_command_list; cmd; cmd = cmd->next) + grub_command_t cmd; + for (cmd = grub_command_list; cmd; cmd = cmd->next) iterate (cmd); return 0; } int -pupa_command_execute (char *cmdline) +grub_command_execute (char *cmdline) { - auto pupa_err_t cmdline_get (char **s); - pupa_err_t cmdline_get (char **s) + auto grub_err_t cmdline_get (char **s); + grub_err_t cmdline_get (char **s) { - *s = pupa_malloc (PUPA_MAX_CMDLINE); + *s = grub_malloc (GRUB_MAX_CMDLINE); *s[0] = '\0'; - return pupa_cmdline_get (">", *s, PUPA_MAX_CMDLINE, 0, 1); + return grub_cmdline_get (">", *s, GRUB_MAX_CMDLINE, 0, 1); } - pupa_command_t cmd; - pupa_err_t ret = 0; + grub_command_t cmd; + grub_err_t ret = 0; char *pager; int num; char **args; - struct pupa_arg_list *state; - struct pupa_arg_option *parser; + struct grub_arg_list *state; + struct grub_arg_option *parser; int maxargs = 0; char **arglist; int numargs; - if (pupa_split_cmdline (cmdline, cmdline_get, &num, &args)) + if (grub_split_cmdline (cmdline, cmdline_get, &num, &args)) return 0; /* In case of an assignment set the environment accordingly instead of calling a function. */ - if (num == 0 && pupa_strchr (args[0], '=')) + if (num == 0 && grub_strchr (args[0], '=')) { - char *val = pupa_strchr (args[0], '='); + char *val = grub_strchr (args[0], '='); val[0] = 0; - pupa_env_set (args[0], val + 1); + grub_env_set (args[0], val + 1); val[0] = '='; return 0; } - cmd = pupa_command_find (args[0]); + cmd = grub_command_find (args[0]); if (! cmd) return -1; /* Enable the pager if the environment pager is set to 1. */ - pager = pupa_env_get ("pager"); - if (pager && (! pupa_strcmp (pager, "1"))) - pupa_set_more (1); + pager = grub_env_get ("pager"); + if (pager && (! grub_strcmp (pager, "1"))) + grub_set_more (1); - parser = (struct pupa_arg_option *) cmd->options; + parser = (struct grub_arg_option *) cmd->options; while (parser && (parser++)->doc) maxargs++; - state = pupa_malloc (sizeof (struct pupa_arg_list) * maxargs); - pupa_memset (state, 0, sizeof (struct pupa_arg_list) * maxargs); - if (pupa_arg_parse (cmd, num, &args[1], state, &arglist, &numargs)) + state = grub_malloc (sizeof (struct grub_arg_list) * maxargs); + grub_memset (state, 0, sizeof (struct grub_arg_list) * maxargs); + if (grub_arg_parse (cmd, num, &args[1], state, &arglist, &numargs)) ret = (cmd->func) (state, numargs, arglist); - pupa_free (state); + grub_free (state); - if (pager && (! pupa_strcmp (pager, "1"))) - pupa_set_more (0); + if (pager && (! grub_strcmp (pager, "1"))) + grub_set_more (0); - pupa_free (args); + grub_free (args); return ret; } -static pupa_err_t -rescue_command (struct pupa_arg_list *state __attribute__ ((unused)), +static grub_err_t +rescue_command (struct grub_arg_list *state __attribute__ ((unused)), int argc __attribute__ ((unused)), char **args __attribute__ ((unused))) { - pupa_longjmp (pupa_exit_env, 0); + grub_longjmp (grub_exit_env, 0); /* Never reach here. */ return 0; } -static pupa_err_t -set_command (struct pupa_arg_list *state __attribute__ ((unused)), +static grub_err_t +set_command (struct grub_arg_list *state __attribute__ ((unused)), int argc, char **args) { char *var; char *val; - auto int print_env (struct pupa_env_var *env); - int print_env (struct pupa_env_var *env) + auto int print_env (struct grub_env_var *env); + int print_env (struct grub_env_var *env) { - pupa_printf ("%s=%s\n", env->name, env->value); + grub_printf ("%s=%s\n", env->name, env->value); return 0; } if (! argc) { - pupa_env_iterate (print_env); + grub_env_iterate (print_env); return 0; } var = args[0]; - val = pupa_strchr (var, '='); + val = grub_strchr (var, '='); if (! val) { - pupa_error (PUPA_ERR_BAD_ARGUMENT, "not an assignment"); - return pupa_errno; + grub_error (GRUB_ERR_BAD_ARGUMENT, "not an assignment"); + return grub_errno; } val[0] = 0; - pupa_env_set (var, val + 1); + grub_env_set (var, val + 1); val[0] = '='; return 0; } -static pupa_err_t -unset_command (struct pupa_arg_list *state __attribute__ ((unused)), +static grub_err_t +unset_command (struct grub_arg_list *state __attribute__ ((unused)), int argc, char **args) { if (argc < 1) - return pupa_error (PUPA_ERR_BAD_ARGUMENT, + return grub_error (GRUB_ERR_BAD_ARGUMENT, "no environment variable specified"); - pupa_env_unset (args[0]); + grub_env_unset (args[0]); return 0; } -static pupa_err_t -insmod_command (struct pupa_arg_list *state __attribute__ ((unused)), +static grub_err_t +insmod_command (struct grub_arg_list *state __attribute__ ((unused)), int argc, char **args) { char *p; - pupa_dl_t mod; + grub_dl_t mod; if (argc == 0) - return pupa_error (PUPA_ERR_BAD_ARGUMENT, "no module specified"); + return grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified"); - p = pupa_strchr (args[0], '/'); + p = grub_strchr (args[0], '/'); if (! p) - mod = pupa_dl_load (args[0]); + mod = grub_dl_load (args[0]); else - mod = pupa_dl_load_file (args[0]); + mod = grub_dl_load_file (args[0]); if (mod) - pupa_dl_ref (mod); + grub_dl_ref (mod); return 0; } -static pupa_err_t -rmmod_command (struct pupa_arg_list *state __attribute__ ((unused)), +static grub_err_t +rmmod_command (struct grub_arg_list *state __attribute__ ((unused)), int argc, char **args) { - pupa_dl_t mod; + grub_dl_t mod; if (argc == 0) - return pupa_error (PUPA_ERR_BAD_ARGUMENT, "no module specified"); + return grub_error (GRUB_ERR_BAD_ARGUMENT, "no module specified"); - mod = pupa_dl_get (args[0]); + mod = grub_dl_get (args[0]); if (! mod) - return pupa_error (PUPA_ERR_BAD_ARGUMENT, "no such module"); + return grub_error (GRUB_ERR_BAD_ARGUMENT, "no such module"); - if (! pupa_dl_unref (mod)) - pupa_dl_unload (mod); + if (! grub_dl_unref (mod)) + grub_dl_unload (mod); return 0; } -static pupa_err_t -lsmod_command (struct pupa_arg_list *state __attribute__ ((unused)), +static grub_err_t +lsmod_command (struct grub_arg_list *state __attribute__ ((unused)), int argc __attribute__ ((unused)), char **args __attribute__ ((unused))) { - auto int print_module (pupa_dl_t mod); + auto int print_module (grub_dl_t mod); - int print_module (pupa_dl_t mod) + int print_module (grub_dl_t mod) { - pupa_dl_dep_t dep; + grub_dl_dep_t dep; - pupa_printf ("%s\t%d\t\t", mod->name, mod->ref_count); + grub_printf ("%s\t%d\t\t", mod->name, mod->ref_count); for (dep = mod->dep; dep; dep = dep->next) { if (dep != mod->dep) - pupa_putchar (','); + grub_putchar (','); - pupa_printf ("%s", dep->mod->name); + grub_printf ("%s", dep->mod->name); } - pupa_putchar ('\n'); - pupa_refresh (); + grub_putchar ('\n'); + grub_refresh (); return 0; } - pupa_printf ("Name\tRef Count\tDependencies\n"); - pupa_dl_iterate (print_module); + grub_printf ("Name\tRef Count\tDependencies\n"); + grub_dl_iterate (print_module); return 0; } void -pupa_command_init (void) +grub_command_init (void) { /* This is a special command, because this never be called actually. */ - pupa_register_command ("title", 0, PUPA_COMMAND_FLAG_TITLE, 0, 0, 0); + grub_register_command ("title", 0, GRUB_COMMAND_FLAG_TITLE, 0, 0, 0); - pupa_register_command ("rescue", rescue_command, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("rescue", rescue_command, GRUB_COMMAND_FLAG_BOTH, "rescue", "Enter into the rescue mode.", 0); - pupa_register_command ("set", set_command, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("set", set_command, GRUB_COMMAND_FLAG_BOTH, "unset ENVVAR", "Set an environment variable.", 0); - pupa_register_command ("unset", unset_command, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("unset", unset_command, GRUB_COMMAND_FLAG_BOTH, "set [ENVVAR=VALUE]", "Remove an environment variable.", 0); - pupa_register_command ("insmod", insmod_command, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("insmod", insmod_command, GRUB_COMMAND_FLAG_BOTH, "insmod MODULE|FILE", "Insert a module.", 0); - pupa_register_command ("rmmod", rmmod_command, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("rmmod", rmmod_command, GRUB_COMMAND_FLAG_BOTH, "rmmod MODULE", "Remove a module.", 0); - pupa_register_command ("lsmod", lsmod_command, PUPA_COMMAND_FLAG_BOTH, + grub_register_command ("lsmod", lsmod_command, GRUB_COMMAND_FLAG_BOTH, "lsmod", "Show loaded modules.", 0); } diff --git a/normal/i386/setjmp.S b/normal/i386/setjmp.S index 6d0ebabdd..d0a8a32b4 100644 --- a/normal/i386/setjmp.S +++ b/normal/i386/setjmp.S @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,16 +17,16 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include +#include .file "setjmp.S" .text /* - * int pupa_setjmp (pupa_jmp_buf env) + * int grub_setjmp (grub_jmp_buf env) */ -FUNCTION(pupa_setjmp) +FUNCTION(grub_setjmp) movl %ebx, 0(%eax) /* EBX */ movl %esi, 4(%eax) /* ESI */ movl %edi, 8(%eax) /* EDI */ @@ -39,9 +39,9 @@ FUNCTION(pupa_setjmp) /* - * int pupa_longjmp (pupa_jmp_buf env, int val) + * int grub_longjmp (grub_jmp_buf env, int val) */ -FUNCTION(pupa_longjmp) +FUNCTION(grub_longjmp) movl 0(%eax), %ebx movl 4(%eax), %esi movl 8(%eax), %edi diff --git a/normal/main.c b/normal/main.c index ddbbfa9da..4070c5be4 100644 --- a/normal/main.c +++ b/normal/main.c @@ -1,6 +1,6 @@ /* main.c - the normal mode main routine */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2000,2001,2002,2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,23 +18,23 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -pupa_jmp_buf pupa_exit_env; +grub_jmp_buf grub_exit_env; -#define PUPA_DEFAULT_HISTORY_SIZE 50 +#define GRUB_DEFAULT_HISTORY_SIZE 50 /* Read a line from the file FILE. */ static int -get_line (pupa_file_t file, char cmdline[], int max_len) +get_line (grub_file_t file, char cmdline[], int max_len) { char c; int pos = 0; @@ -43,7 +43,7 @@ get_line (pupa_file_t file, char cmdline[], int max_len) while (1) { - if (pupa_file_read (file, &c, 1) != 1) + if (grub_file_read (file, &c, 1) != 1) break; /* Skip all carriage returns. */ @@ -82,7 +82,7 @@ get_line (pupa_file_t file, char cmdline[], int max_len) { if (c == '#') comment = 1; - else if (! pupa_isspace (c)) + else if (! grub_isspace (c)) cmdline[pos++] = c; } else @@ -101,51 +101,51 @@ get_line (pupa_file_t file, char cmdline[], int max_len) } static void -free_menu (pupa_menu_t menu) +free_menu (grub_menu_t menu) { - pupa_menu_entry_t entry = menu->entry_list; + grub_menu_entry_t entry = menu->entry_list; while (entry) { - pupa_menu_entry_t next_entry = entry->next; - pupa_command_list_t cmd = entry->command_list; + grub_menu_entry_t next_entry = entry->next; + grub_command_list_t cmd = entry->command_list; while (cmd) { - pupa_command_list_t next_cmd = cmd->next; + grub_command_list_t next_cmd = cmd->next; - pupa_free ((void *) cmd->command); + grub_free ((void *) cmd->command); cmd = next_cmd; } - pupa_free ((void *) entry->title); + grub_free ((void *) entry->title); entry = next_entry; } - pupa_free (menu); + grub_free (menu); } /* Read the config file CONFIG and return a menu. If no entry is present, return NULL. */ -static pupa_menu_t +static grub_menu_t read_config_file (const char *config) { - pupa_file_t file; - static char cmdline[PUPA_MAX_CMDLINE]; - pupa_menu_t menu; - pupa_menu_entry_t *next_entry, cur_entry = 0; - pupa_command_list_t *next_cmd, cur_cmd; + grub_file_t file; + static char cmdline[GRUB_MAX_CMDLINE]; + grub_menu_t menu; + grub_menu_entry_t *next_entry, cur_entry = 0; + grub_command_list_t *next_cmd, cur_cmd; /* Try to open the config file. */ - file = pupa_file_open (config); + file = grub_file_open (config); if (! file) return 0; /* Initialize the menu. */ - menu = (pupa_menu_t) pupa_malloc (sizeof (*menu)); + menu = (grub_menu_t) grub_malloc (sizeof (*menu)); if (! menu) { - pupa_file_close (file); + grub_file_close (file); return 0; } menu->default_entry = 0; @@ -160,33 +160,33 @@ read_config_file (const char *config) /* Read each line. */ while (get_line (file, cmdline, sizeof (cmdline))) { - pupa_command_t cmd; + grub_command_t cmd; - cmd = pupa_command_find (cmdline); - pupa_errno = PUPA_ERR_NONE; + cmd = grub_command_find (cmdline); + grub_errno = GRUB_ERR_NONE; if (! cmd) { - pupa_printf ("Unknown command `%s' is ignored.\n", cmdline); + grub_printf ("Unknown command `%s' is ignored.\n", cmdline); continue; } - if (cmd->flags & PUPA_COMMAND_FLAG_TITLE) + if (cmd->flags & GRUB_COMMAND_FLAG_TITLE) { char *p; - cur_entry = (pupa_menu_entry_t) pupa_malloc (sizeof (*cur_entry)); + cur_entry = (grub_menu_entry_t) grub_malloc (sizeof (*cur_entry)); if (! cur_entry) goto fail; - p = pupa_strchr (cmdline, ' '); + p = grub_strchr (cmdline, ' '); if (p) - cur_entry->title = pupa_strdup (p); + cur_entry->title = grub_strdup (p); else - cur_entry->title = pupa_strdup (""); + cur_entry->title = grub_strdup (""); if (! cur_entry->title) { - pupa_free (cur_entry); + grub_free (cur_entry); goto fail; } @@ -204,28 +204,28 @@ read_config_file (const char *config) else if (! cur_entry) { /* Run the command if possible. */ - if (cmd->flags & PUPA_COMMAND_FLAG_MENU) + if (cmd->flags & GRUB_COMMAND_FLAG_MENU) { - pupa_command_execute (cmdline); - pupa_print_error (); - pupa_errno = PUPA_ERR_NONE; + grub_command_execute (cmdline); + grub_print_error (); + grub_errno = GRUB_ERR_NONE; } else { - pupa_printf ("Invalid command `%s' is ignored.\n", cmdline); + grub_printf ("Invalid command `%s' is ignored.\n", cmdline); continue; } } else { - cur_cmd = (pupa_command_list_t) pupa_malloc (sizeof (*cur_cmd)); + cur_cmd = (grub_command_list_t) grub_malloc (sizeof (*cur_cmd)); if (! cur_cmd) goto fail; - cur_cmd->command = pupa_strdup (cmdline); + cur_cmd->command = grub_strdup (cmdline); if (! cur_cmd->command) { - pupa_free (cur_cmd); + grub_free (cur_cmd); goto fail; } @@ -240,10 +240,10 @@ read_config_file (const char *config) fail: - pupa_file_close (file); + grub_file_close (file); /* If no entry was found or any error occurred, return NULL. */ - if (menu->size == 0 || pupa_errno != PUPA_ERR_NONE) + if (menu->size == 0 || grub_errno != GRUB_ERR_NONE) { free_menu (menu); return 0; @@ -269,46 +269,46 @@ read_config_file (const char *config) /* This starts the normal mode. */ void -pupa_enter_normal_mode (const char *config) +grub_enter_normal_mode (const char *config) { - if (pupa_setjmp (pupa_exit_env) == 0) - pupa_normal_execute (config, 0); + if (grub_setjmp (grub_exit_env) == 0) + grub_normal_execute (config, 0); } /* Initialize the screen. */ void -pupa_normal_init_page (void) +grub_normal_init_page (void) { - pupa_cls (); - pupa_printf ("\n\ - PUPA version %s\n\n", + grub_cls (); + grub_printf ("\n\ + GRUB version %s\n\n", PACKAGE_VERSION); } /* Read the config file CONFIG and execute the menu interface or the command-line interface. */ void -pupa_normal_execute (const char *config, int nested) +grub_normal_execute (const char *config, int nested) { - pupa_menu_t menu = 0; + grub_menu_t menu = 0; if (config) { menu = read_config_file (config); /* Ignore any error. */ - pupa_errno = PUPA_ERR_NONE; + grub_errno = GRUB_ERR_NONE; } if (menu) - pupa_menu_run (menu, nested); + grub_menu_run (menu, nested); else - pupa_cmdline_run (nested); + grub_cmdline_run (nested); } /* Enter normal mode from rescue mode. */ static void -pupa_rescue_cmd_normal (int argc, char *argv[]) +grub_rescue_cmd_normal (int argc, char *argv[]) { if (argc == 0) { @@ -316,65 +316,65 @@ pupa_rescue_cmd_normal (int argc, char *argv[]) char *config; const char *prefix; - prefix = pupa_env_get ("prefix"); + prefix = grub_env_get ("prefix"); if (prefix) { - config = pupa_malloc (pupa_strlen (prefix) + sizeof ("/pupa.cfg")); + config = grub_malloc (grub_strlen (prefix) + sizeof ("/grub.cfg")); if (! config) return; - pupa_sprintf (config, "%s/pupa.cfg", prefix); - pupa_enter_normal_mode (config); - pupa_free (config); + grub_sprintf (config, "%s/grub.cfg", prefix); + grub_enter_normal_mode (config); + grub_free (config); } else - pupa_enter_normal_mode (0); + grub_enter_normal_mode (0); } else - pupa_enter_normal_mode (argv[0]); + grub_enter_normal_mode (argv[0]); } -#ifdef PUPA_UTIL +#ifdef GRUB_UTIL void -pupa_normal_init (void) +grub_normal_init (void) { - pupa_set_history (PUPA_DEFAULT_HISTORY_SIZE); + grub_set_history (GRUB_DEFAULT_HISTORY_SIZE); /* Register a command "normal" for the rescue mode. */ - pupa_rescue_register_command ("normal", pupa_rescue_cmd_normal, + grub_rescue_register_command ("normal", grub_rescue_cmd_normal, "enter normal mode"); /* This registers some built-in commands. */ - pupa_command_init (); + grub_command_init (); } void -pupa_normal_fini (void) +grub_normal_fini (void) { - pupa_set_history (0); - pupa_rescue_unregister_command ("normal"); + grub_set_history (0); + grub_rescue_unregister_command ("normal"); } -#else /* ! PUPA_UTIL */ -PUPA_MOD_INIT +#else /* ! GRUB_UTIL */ +GRUB_MOD_INIT { /* Normal mode shouldn't be unloaded. */ - pupa_dl_ref (mod); + grub_dl_ref (mod); - pupa_set_history (PUPA_DEFAULT_HISTORY_SIZE); + grub_set_history (GRUB_DEFAULT_HISTORY_SIZE); /* Register a command "normal" for the rescue mode. */ - pupa_rescue_register_command ("normal", pupa_rescue_cmd_normal, + grub_rescue_register_command ("normal", grub_rescue_cmd_normal, "enter normal mode"); /* This registers some built-in commands. */ - pupa_command_init (); + grub_command_init (); } -PUPA_MOD_FINI +GRUB_MOD_FINI { - pupa_set_history (0); - pupa_rescue_unregister_command ("normal"); + grub_set_history (0); + grub_rescue_unregister_command ("normal"); } -#endif /* ! PUPA_UTIL */ +#endif /* ! GRUB_UTIL */ diff --git a/normal/menu.c b/normal/menu.c index 09b2725df..a6a7de753 100644 --- a/normal/menu.c +++ b/normal/menu.c @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,9 +17,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include +#include +#include +#include /* FIXME: These below are all runaround. */ @@ -39,55 +39,55 @@ draw_border (void) { unsigned i; - pupa_setcolorstate (PUPA_TERM_COLOR_NORMAL); + grub_setcolorstate (GRUB_TERM_COLOR_NORMAL); - pupa_gotoxy (1, 3); - pupa_putcode (DISP_UL); + grub_gotoxy (1, 3); + grub_putcode (DISP_UL); for (i = 0; i < 73; i++) - pupa_putcode (DISP_HLINE); - pupa_putcode (DISP_UR); + grub_putcode (DISP_HLINE); + grub_putcode (DISP_UR); i = 1; while (1) { - pupa_gotoxy (1, 3 + i); + grub_gotoxy (1, 3 + i); if (i > 12) break; - pupa_putcode (DISP_VLINE); - pupa_gotoxy (75, 3 + i); - pupa_putcode (DISP_VLINE); + grub_putcode (DISP_VLINE); + grub_gotoxy (75, 3 + i); + grub_putcode (DISP_VLINE); i++; } - pupa_putcode (DISP_LL); + grub_putcode (DISP_LL); for (i = 0; i < 73; i++) - pupa_putcode (DISP_HLINE); - pupa_putcode (DISP_LR); + grub_putcode (DISP_HLINE); + grub_putcode (DISP_LR); - pupa_setcolorstate (PUPA_TERM_COLOR_STANDARD); + grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); } static void print_message (int nested) { - pupa_printf ("\n\ + grub_printf ("\n\ Use the %C and %C keys to select which entry is highlighted.\n", - (pupa_uint32_t) DISP_UP, (pupa_uint32_t) DISP_DOWN); - pupa_printf ("\ + (grub_uint32_t) DISP_UP, (grub_uint32_t) DISP_DOWN); + grub_printf ("\ Press enter to boot the selected OS, \'e\' to edit the\n\ commands before booting, or \'c\' for a command-line."); if (nested) - pupa_printf ("\ + grub_printf ("\ ESC to return previous menu."); } -static pupa_menu_entry_t -get_entry (pupa_menu_t menu, int no) +static grub_menu_entry_t +get_entry (grub_menu_t menu, int no) { - pupa_menu_entry_t e; + grub_menu_entry_t e; for (e = menu->entry_list; e && no > 0; e = e->next, no--) ; @@ -96,48 +96,48 @@ get_entry (pupa_menu_t menu, int no) } static void -print_entry (int y, int highlight, pupa_menu_entry_t entry) +print_entry (int y, int highlight, grub_menu_entry_t entry) { int x; const char *title; title = entry ? entry->title : ""; - pupa_setcolorstate (highlight - ? PUPA_TERM_COLOR_HIGHLIGHT - : PUPA_TERM_COLOR_NORMAL); + grub_setcolorstate (highlight + ? GRUB_TERM_COLOR_HIGHLIGHT + : GRUB_TERM_COLOR_NORMAL); - pupa_gotoxy (2, y); - pupa_putchar (' '); + grub_gotoxy (2, y); + grub_putchar (' '); for (x = 3; x < 75; x++) { if (*title && x <= 72) { if (x == 72) - pupa_putcode (DISP_RIGHT); + grub_putcode (DISP_RIGHT); else - pupa_putchar (*title++); + grub_putchar (*title++); } else - pupa_putchar (' '); + grub_putchar (' '); } - pupa_gotoxy (74, y); + grub_gotoxy (74, y); - pupa_setcolorstate (PUPA_TERM_COLOR_STANDARD); + grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); } static void -print_entries (pupa_menu_t menu, int first, int offset) +print_entries (grub_menu_t menu, int first, int offset) { - pupa_menu_entry_t e; + grub_menu_entry_t e; int i; - pupa_gotoxy (77, 4); + grub_gotoxy (77, 4); if (first) - pupa_putcode (DISP_UP); + grub_putcode (DISP_UP); else - pupa_putchar (' '); + grub_putchar (' '); e = get_entry (menu, first); @@ -148,30 +148,30 @@ print_entries (pupa_menu_t menu, int first, int offset) e = e->next; } - pupa_gotoxy (77, 4 + 12); + grub_gotoxy (77, 4 + 12); if (e) - pupa_putcode (DISP_DOWN); + grub_putcode (DISP_DOWN); else - pupa_putchar (' '); + grub_putchar (' '); - pupa_gotoxy (74, 4 + offset); + grub_gotoxy (74, 4 + offset); } static void init_page (int nested) { - pupa_normal_init_page (); + grub_normal_init_page (); draw_border (); print_message (nested); } static int -run_menu (pupa_menu_t menu, int nested) +run_menu (grub_menu_t menu, int nested) { int first, offset; - pupa_setcursor (0); + grub_setcursor (0); first = 0; offset = menu->default_entry; @@ -183,13 +183,13 @@ run_menu (pupa_menu_t menu, int nested) init_page (nested); print_entries (menu, first, offset); - pupa_refresh (); + grub_refresh (); while (1) { int c; - c = PUPA_TERM_ASCII_CHAR (pupa_getkey ()); + c = GRUB_TERM_ASCII_CHAR (grub_getkey ()); switch (c) { case 16: @@ -230,21 +230,21 @@ run_menu (pupa_menu_t menu, int nested) case '\n': case '\r': case 6: - pupa_setcursor (1); + grub_setcursor (1); return first + offset; case '\e': if (nested) { - pupa_setcursor (1); + grub_setcursor (1); return -1; } break; case 'c': - pupa_setcursor (1); - pupa_cmdline_run (1); - pupa_setcursor (0); + grub_setcursor (1); + grub_cmdline_run (1); + grub_setcursor (0); init_page (nested); print_entries (menu, first, offset); break; @@ -253,7 +253,7 @@ run_menu (pupa_menu_t menu, int nested) break; } - pupa_refresh (); + grub_refresh (); } /* Never reach here. */ @@ -261,7 +261,7 @@ run_menu (pupa_menu_t menu, int nested) } void -pupa_menu_run (pupa_menu_t menu, int nested) +grub_menu_run (grub_menu_t menu, int nested) { while (1) { diff --git a/term/i386/pc/console.c b/term/i386/pc/console.c index 9746c29e2..ea7a05a9e 100644 --- a/term/i386/pc/console.c +++ b/term/i386/pc/console.c @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,17 +17,17 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include +#include +#include +#include -pupa_uint8_t pupa_console_cur_color = 0x7; -static pupa_uint8_t pupa_console_standard_color = 0x7; -static pupa_uint8_t pupa_console_normal_color = 0x7; -static pupa_uint8_t pupa_console_highlight_color = 0x70; +grub_uint8_t grub_console_cur_color = 0x7; +static grub_uint8_t grub_console_standard_color = 0x7; +static grub_uint8_t grub_console_normal_color = 0x7; +static grub_uint8_t grub_console_highlight_color = 0x70; static void -pupa_console_putchar (pupa_uint32_t c) +grub_console_putchar (grub_uint32_t c) { if (c > 0x7f) { @@ -71,21 +71,21 @@ pupa_console_putchar (pupa_uint32_t c) } } - pupa_console_real_putchar (c); + grub_console_real_putchar (c); } static void -pupa_console_setcolorstate (pupa_term_color_state state) +grub_console_setcolorstate (grub_term_color_state state) { switch (state) { - case PUPA_TERM_COLOR_STANDARD: - pupa_console_cur_color = pupa_console_standard_color; + case GRUB_TERM_COLOR_STANDARD: + grub_console_cur_color = grub_console_standard_color; break; - case PUPA_TERM_COLOR_NORMAL: - pupa_console_cur_color = pupa_console_normal_color; + case GRUB_TERM_COLOR_NORMAL: + grub_console_cur_color = grub_console_normal_color; break; - case PUPA_TERM_COLOR_HIGHLIGHT: - pupa_console_cur_color = pupa_console_highlight_color; + case GRUB_TERM_COLOR_HIGHLIGHT: + grub_console_cur_color = grub_console_highlight_color; break; default: break; @@ -93,33 +93,33 @@ pupa_console_setcolorstate (pupa_term_color_state state) } static void -pupa_console_setcolor (pupa_uint8_t normal_color, pupa_uint8_t highlight_color) +grub_console_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color) { - pupa_console_normal_color = normal_color; - pupa_console_highlight_color = highlight_color; + grub_console_normal_color = normal_color; + grub_console_highlight_color = highlight_color; } -static struct pupa_term pupa_console_term = +static struct grub_term grub_console_term = { .name = "console", .init = 0, .fini = 0, - .putchar = pupa_console_putchar, - .checkkey = pupa_console_checkkey, - .getkey = pupa_console_getkey, - .getxy = pupa_console_getxy, - .gotoxy = pupa_console_gotoxy, - .cls = pupa_console_cls, - .setcolorstate = pupa_console_setcolorstate, - .setcolor = pupa_console_setcolor, - .setcursor = pupa_console_setcursor, + .putchar = grub_console_putchar, + .checkkey = grub_console_checkkey, + .getkey = grub_console_getkey, + .getxy = grub_console_getxy, + .gotoxy = grub_console_gotoxy, + .cls = grub_console_cls, + .setcolorstate = grub_console_setcolorstate, + .setcolor = grub_console_setcolor, + .setcursor = grub_console_setcursor, .flags = 0, .next = 0 }; void -pupa_console_init (void) +grub_console_init (void) { - pupa_term_register (&pupa_console_term); - pupa_term_set_current (&pupa_console_term); + grub_term_register (&grub_console_term); + grub_term_set_current (&grub_console_term); } diff --git a/term/i386/pc/vga.c b/term/i386/pc/vga.c index b715f2bdf..bd5c2128d 100644 --- a/term/i386/pc/vga.c +++ b/term/i386/pc/vga.c @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2000,2001,2002,2003,2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -17,15 +17,15 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #define DEBUG_VGA 0 @@ -43,7 +43,7 @@ struct colored_char { /* An Unicode codepoint. */ - pupa_uint32_t code; + grub_uint32_t code; /* Color indexes. */ unsigned char fg_color; @@ -56,7 +56,7 @@ struct colored_char unsigned char index; }; -static pupa_dl_t my_mod; +static grub_dl_t my_mod; static unsigned char text_mode; static unsigned xpos, ypos; static int cursor_state; @@ -120,30 +120,30 @@ set_map_mask (unsigned char mask) outb (SEQUENCER_ADDR_PORT, old_addr); } -static pupa_err_t -pupa_vga_init (void) +static grub_err_t +grub_vga_init (void) { - vga_font = pupa_vga_get_font (); - text_mode = pupa_vga_set_mode (0x12); + vga_font = grub_vga_get_font (); + text_mode = grub_vga_set_mode (0x12); cursor_state = 1; fg_color = DEFAULT_FG_COLOR; bg_color = DEFAULT_BG_COLOR; saved_map_mask = get_map_mask (); set_map_mask (0x0f); - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } -static pupa_err_t -pupa_vga_fini (void) +static grub_err_t +grub_vga_fini (void) { set_map_mask (saved_map_mask); - pupa_vga_set_mode (text_mode); - return PUPA_ERR_NONE; + grub_vga_set_mode (text_mode); + return GRUB_ERR_NONE; } static int -get_vga_glyph (pupa_uint32_t code, unsigned char bitmap[32], unsigned *width) +get_vga_glyph (grub_uint32_t code, unsigned char bitmap[32], unsigned *width) { if (code > 0x7f) { @@ -182,12 +182,12 @@ get_vga_glyph (pupa_uint32_t code, unsigned char bitmap[32], unsigned *width) break; default: - return pupa_font_get_glyph (code, bitmap, width); + return grub_font_get_glyph (code, bitmap, width); } } if (bitmap) - pupa_memcpy (bitmap, vga_font + code * CHAR_HEIGHT, CHAR_HEIGHT); + grub_memcpy (bitmap, vga_font + code * CHAR_HEIGHT, CHAR_HEIGHT); *width = 1; return 1; @@ -284,7 +284,7 @@ scroll_up (void) unsigned i; unsigned plane; - pupa_memmove (text_buf, text_buf + TEXT_WIDTH, + grub_memmove (text_buf, text_buf + TEXT_WIDTH, sizeof (struct colored_char) * TEXT_WIDTH * (TEXT_HEIGHT - 1)); for (i = TEXT_WIDTH * (TEXT_HEIGHT - 1); i < TEXT_WIDTH * TEXT_HEIGHT; i++) @@ -299,17 +299,17 @@ scroll_up (void) for (plane = 0x1; plane <= 0x8; plane <<= 1) { set_map_mask (plane); - pupa_memmove (VGA_MEM, VGA_MEM + VGA_WIDTH * CHAR_HEIGHT / 8, + grub_memmove (VGA_MEM, VGA_MEM + VGA_WIDTH * CHAR_HEIGHT / 8, VGA_WIDTH * (VGA_HEIGHT - CHAR_HEIGHT) / 8); } set_map_mask (0x0f); - pupa_memset (VGA_MEM + VGA_WIDTH * (VGA_HEIGHT - CHAR_HEIGHT) / 8, 0, + grub_memset (VGA_MEM + VGA_WIDTH * (VGA_HEIGHT - CHAR_HEIGHT) / 8, 0, VGA_WIDTH * CHAR_HEIGHT / 8); } static void -pupa_vga_putchar (pupa_uint32_t c) +grub_vga_putchar (grub_uint32_t c) { #if DEBUG_VGA static int show = 1; @@ -355,7 +355,7 @@ pupa_vga_putchar (pupa_uint32_t c) get_vga_glyph (c, 0, &width); if (xpos + width > TEXT_WIDTH) - pupa_putchar ('\n'); + grub_putchar ('\n'); p = text_buf + xpos + ypos * TEXT_WIDTH; p->code = c; @@ -396,29 +396,29 @@ pupa_vga_putchar (pupa_uint32_t c) #if DEBUG_VGA if (show) { - pupa_uint16_t pos = pupa_getxy (); + grub_uint16_t pos = grub_getxy (); show = 0; - pupa_gotoxy (0, 0); - pupa_printf ("[%u:%u]", (unsigned) (pos >> 8), (unsigned) (pos & 0xff)); - pupa_gotoxy (pos >> 8, pos & 0xff); + grub_gotoxy (0, 0); + grub_printf ("[%u:%u]", (unsigned) (pos >> 8), (unsigned) (pos & 0xff)); + grub_gotoxy (pos >> 8, pos & 0xff); show = 1; } #endif } -static pupa_uint16_t -pupa_vga_getxy (void) +static grub_uint16_t +grub_vga_getxy (void) { return ((xpos << 8) | ypos); } static void -pupa_vga_gotoxy (pupa_uint8_t x, pupa_uint8_t y) +grub_vga_gotoxy (grub_uint8_t x, grub_uint8_t y) { if (x >= TEXT_WIDTH || y >= TEXT_HEIGHT) { - pupa_error (PUPA_ERR_OUT_OF_RANGE, "invalid point (%u,%u)", + grub_error (GRUB_ERR_OUT_OF_RANGE, "invalid point (%u,%u)", (unsigned) x, (unsigned) y); return; } @@ -434,7 +434,7 @@ pupa_vga_gotoxy (pupa_uint8_t x, pupa_uint8_t y) } static void -pupa_vga_cls (void) +grub_vga_cls (void) { unsigned i; @@ -447,22 +447,22 @@ pupa_vga_cls (void) text_buf[i].index = 0; } - pupa_memset (VGA_MEM, 0, VGA_WIDTH * VGA_HEIGHT / 8); + grub_memset (VGA_MEM, 0, VGA_WIDTH * VGA_HEIGHT / 8); xpos = ypos = 0; } static void -pupa_vga_setcolorstate (pupa_term_color_state state) +grub_vga_setcolorstate (grub_term_color_state state) { switch (state) { - case PUPA_TERM_COLOR_STANDARD: - case PUPA_TERM_COLOR_NORMAL: + case GRUB_TERM_COLOR_STANDARD: + case GRUB_TERM_COLOR_NORMAL: fg_color = DEFAULT_FG_COLOR; bg_color = DEFAULT_BG_COLOR; break; - case PUPA_TERM_COLOR_HIGHLIGHT: + case GRUB_TERM_COLOR_HIGHLIGHT: fg_color = DEFAULT_BG_COLOR; bg_color = DEFAULT_FG_COLOR; break; @@ -472,14 +472,14 @@ pupa_vga_setcolorstate (pupa_term_color_state state) } static void -pupa_vga_setcolor (pupa_uint8_t normal_color __attribute__ ((unused)), - pupa_uint8_t highlight_color __attribute__ ((unused))) +grub_vga_setcolor (grub_uint8_t normal_color __attribute__ ((unused)), + grub_uint8_t highlight_color __attribute__ ((unused))) { /* FIXME */ } static void -pupa_vga_setcursor (int on) +grub_vga_setcursor (int on) { if (cursor_state != on) { @@ -492,43 +492,43 @@ pupa_vga_setcursor (int on) } } -static struct pupa_term pupa_vga_term = +static struct grub_term grub_vga_term = { .name = "vga", - .init = pupa_vga_init, - .fini = pupa_vga_fini, - .putchar = pupa_vga_putchar, - .checkkey = pupa_console_checkkey, - .getkey = pupa_console_getkey, - .getxy = pupa_vga_getxy, - .gotoxy = pupa_vga_gotoxy, - .cls = pupa_vga_cls, - .setcolorstate = pupa_vga_setcolorstate, - .setcolor = pupa_vga_setcolor, - .setcursor = pupa_vga_setcursor, + .init = grub_vga_init, + .fini = grub_vga_fini, + .putchar = grub_vga_putchar, + .checkkey = grub_console_checkkey, + .getkey = grub_console_getkey, + .getxy = grub_vga_getxy, + .gotoxy = grub_vga_gotoxy, + .cls = grub_vga_cls, + .setcolorstate = grub_vga_setcolorstate, + .setcolor = grub_vga_setcolor, + .setcursor = grub_vga_setcursor, .flags = 0, .next = 0 }; -static pupa_err_t -debug_command (struct pupa_arg_list *state __attribute__ ((unused)), +static grub_err_t +debug_command (struct grub_arg_list *state __attribute__ ((unused)), int argc __attribute__ ((unused)), char **args __attribute__ ((unused))) { - pupa_printf ("???????¡ã??n"); + grub_printf ("???????¡ã??n"); return 0; } -PUPA_MOD_INIT +GRUB_MOD_INIT { my_mod = mod; - pupa_term_register (&pupa_vga_term); - pupa_register_command ("debug", debug_command, PUPA_COMMAND_FLAG_CMDLINE, + grub_term_register (&grub_vga_term); + grub_register_command ("debug", debug_command, GRUB_COMMAND_FLAG_CMDLINE, "debug", "Debug it!", 0); } -PUPA_MOD_FINI +GRUB_MOD_FINI { - pupa_term_unregister (&pupa_vga_term); + grub_term_unregister (&grub_vga_term); } diff --git a/term/powerpc/ieee1275/ofconsole.c b/term/powerpc/ieee1275/ofconsole.c index 786e7e27c..2befd85f1 100644 --- a/term/powerpc/ieee1275/ofconsole.c +++ b/term/powerpc/ieee1275/ofconsole.c @@ -1,6 +1,6 @@ -/* ofconsole.c -- Open Firmware console for PUPA. */ +/* ofconsole.c -- Open Firmware console for GRUB. */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003, 2004 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -18,20 +18,20 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include -static pupa_ieee1275_ihandle_t stdout_ihandle; -static pupa_ieee1275_ihandle_t stdin_ihandle; +static grub_ieee1275_ihandle_t stdout_ihandle; +static grub_ieee1275_ihandle_t stdin_ihandle; -static int pupa_curr_x; -static int pupa_curr_y; +static int grub_curr_x; +static int grub_curr_y; -static int pupa_keybuf; -static int pupa_buflen; +static int grub_keybuf; +static int grub_buflen; struct color { @@ -58,32 +58,32 @@ static int bgcolor = 0; /* Write control characters to the console. */ static void -pupa_ofconsole_writeesc (const char *str) +grub_ofconsole_writeesc (const char *str) { while (*str) { char chr = *(str++); - pupa_ieee1275_write (stdout_ihandle, &chr, 1, 0); + grub_ieee1275_write (stdout_ihandle, &chr, 1, 0); } } static void -pupa_ofconsole_putchar (pupa_uint32_t c) +grub_ofconsole_putchar (grub_uint32_t c) { char chr = c; if (c == '\n') { - pupa_curr_y++; - pupa_curr_x = 0; + grub_curr_y++; + grub_curr_x = 0; } else - pupa_curr_x++; - pupa_ieee1275_write (stdout_ihandle, &chr, 1, 0); + grub_curr_x++; + grub_ieee1275_write (stdout_ihandle, &chr, 1, 0); } static void -pupa_ofconsole_setcolorstate (pupa_term_color_state state) +grub_ofconsole_setcolorstate (grub_term_color_state state) { char setcol[20]; int fg; @@ -91,12 +91,12 @@ pupa_ofconsole_setcolorstate (pupa_term_color_state state) switch (state) { - case PUPA_TERM_COLOR_STANDARD: - case PUPA_TERM_COLOR_NORMAL: + case GRUB_TERM_COLOR_STANDARD: + case GRUB_TERM_COLOR_NORMAL: fg = fgcolor; bg = bgcolor; break; - case PUPA_TERM_COLOR_HIGHLIGHT: + case GRUB_TERM_COLOR_HIGHLIGHT: fg = bgcolor; bg = fgcolor; break; @@ -104,29 +104,29 @@ pupa_ofconsole_setcolorstate (pupa_term_color_state state) return; } - pupa_sprintf (setcol, "\e[3%dm\e[4%dm", fg, bg); - pupa_ofconsole_writeesc (setcol); + grub_sprintf (setcol, "\e[3%dm\e[4%dm", fg, bg); + grub_ofconsole_writeesc (setcol); } static void -pupa_ofconsole_setcolor (pupa_uint8_t normal_color, - pupa_uint8_t highlight_color) +grub_ofconsole_setcolor (grub_uint8_t normal_color, + grub_uint8_t highlight_color) { fgcolor = normal_color; bgcolor = highlight_color; } static int -pupa_ofconsole_readkey (int *key) +grub_ofconsole_readkey (int *key) { char c; int actual = 0; - pupa_ieee1275_read (stdin_ihandle, &c, 1, &actual); + grub_ieee1275_read (stdin_ihandle, &c, 1, &actual); if (actual && c == '\e') { - pupa_ieee1275_read (stdin_ihandle, &c, 1, &actual); + grub_ieee1275_read (stdin_ihandle, &c, 1, &actual); if (! actual) { *key = '\e'; @@ -136,7 +136,7 @@ pupa_ofconsole_readkey (int *key) if (c != 91) return 0; - pupa_ieee1275_read (stdin_ihandle, &c, 1, &actual); + grub_ieee1275_read (stdin_ihandle, &c, 1, &actual); if (! actual) return 0; @@ -166,19 +166,19 @@ pupa_ofconsole_readkey (int *key) } static int -pupa_ofconsole_checkkey (void) +grub_ofconsole_checkkey (void) { int key; int read; - if (pupa_buflen) + if (grub_buflen) return 1; - read = pupa_ofconsole_readkey (&key); + read = grub_ofconsole_readkey (&key); if (read) { - pupa_keybuf = key; - pupa_buflen = 1; + grub_keybuf = key; + grub_buflen = 1; return 1; } @@ -186,123 +186,123 @@ pupa_ofconsole_checkkey (void) } static int -pupa_ofconsole_getkey (void) +grub_ofconsole_getkey (void) { int key; - if (pupa_buflen) + if (grub_buflen) { - pupa_buflen =0; - return pupa_keybuf; + grub_buflen =0; + return grub_keybuf; } - while (! pupa_ofconsole_readkey (&key)); + while (! grub_ofconsole_readkey (&key)); return key; } -static pupa_uint16_t -pupa_ofconsole_getxy (void) +static grub_uint16_t +grub_ofconsole_getxy (void) { - return ((pupa_curr_x - 1) << 8) | pupa_curr_y; + return ((grub_curr_x - 1) << 8) | grub_curr_y; } static void -pupa_ofconsole_gotoxy (pupa_uint8_t x, pupa_uint8_t y) +grub_ofconsole_gotoxy (grub_uint8_t x, grub_uint8_t y) { char s[11]; /* 5 + 3 + 3. */ - pupa_curr_x = x; - pupa_curr_y = y; + grub_curr_x = x; + grub_curr_y = y; - pupa_sprintf (s, "\e[%d;%dH", y - 1, x + 1); - pupa_ofconsole_writeesc (s); + grub_sprintf (s, "\e[%d;%dH", y - 1, x + 1); + grub_ofconsole_writeesc (s); } static void -pupa_ofconsole_cls (void) +grub_ofconsole_cls (void) { /* Clear the screen. */ - pupa_ofconsole_writeesc (" "); + grub_ofconsole_writeesc (" "); } static void -pupa_ofconsole_setcursor (int on __attribute ((unused))) +grub_ofconsole_setcursor (int on __attribute ((unused))) { /* XXX: Not supported. */ } static void -pupa_ofconsole_refresh (void) +grub_ofconsole_refresh (void) { /* Do nothing, the current console state is ok. */ } -static pupa_err_t -pupa_ofconsole_init (void) +static grub_err_t +grub_ofconsole_init (void) { - pupa_ieee1275_phandle_t chosen; + grub_ieee1275_phandle_t chosen; char data[4]; - pupa_size_t actual; + grub_size_t actual; int col; - if (pupa_ieee1275_finddevice ("/chosen", &chosen)) - return pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "Cannot find /chosen"); + if (grub_ieee1275_finddevice ("/chosen", &chosen)) + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find /chosen"); - if (pupa_ieee1275_get_property (chosen, "stdout", data, sizeof data, + if (grub_ieee1275_get_property (chosen, "stdout", data, sizeof data, &actual) || actual != sizeof data) - return pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "Cannot find stdout"); + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdout"); - stdout_ihandle = pupa_ieee1275_decode_int_4 (data); + stdout_ihandle = grub_ieee1275_decode_int_4 (data); - if (pupa_ieee1275_get_property (chosen, "stdin", data, sizeof data, + if (grub_ieee1275_get_property (chosen, "stdin", data, sizeof data, &actual) || actual != sizeof data) - return pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "Cannot find stdin"); + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Cannot find stdin"); - stdin_ihandle = pupa_ieee1275_decode_int_4 (data); + stdin_ihandle = grub_ieee1275_decode_int_4 (data); /* Initialize colors. */ for (col = 0; col < 7; col++) - pupa_ieee1275_set_color (stdout_ihandle, col, colors[col].red, + grub_ieee1275_set_color (stdout_ihandle, col, colors[col].red, colors[col].green, colors[col].blue); /* Set the right fg and bg colors. */ - pupa_ofconsole_setcolorstate (PUPA_TERM_COLOR_NORMAL); + grub_ofconsole_setcolorstate (GRUB_TERM_COLOR_NORMAL); return 0; } -static pupa_err_t -pupa_ofconsole_fini (void) +static grub_err_t +grub_ofconsole_fini (void) { return 0; } -static struct pupa_term pupa_ofconsole_term = +static struct grub_term grub_ofconsole_term = { .name = "ofconsole", - .init = pupa_ofconsole_init, - .fini = pupa_ofconsole_fini, - .putchar = pupa_ofconsole_putchar, - .checkkey = pupa_ofconsole_checkkey, - .getkey = pupa_ofconsole_getkey, - .getxy = pupa_ofconsole_getxy, - .gotoxy = pupa_ofconsole_gotoxy, - .cls = pupa_ofconsole_cls, - .setcolorstate = pupa_ofconsole_setcolorstate, - .setcolor = pupa_ofconsole_setcolor, - .setcursor = pupa_ofconsole_setcursor, - .refresh = pupa_ofconsole_refresh, + .init = grub_ofconsole_init, + .fini = grub_ofconsole_fini, + .putchar = grub_ofconsole_putchar, + .checkkey = grub_ofconsole_checkkey, + .getkey = grub_ofconsole_getkey, + .getxy = grub_ofconsole_getxy, + .gotoxy = grub_ofconsole_gotoxy, + .cls = grub_ofconsole_cls, + .setcolorstate = grub_ofconsole_setcolorstate, + .setcolor = grub_ofconsole_setcolor, + .setcursor = grub_ofconsole_setcursor, + .refresh = grub_ofconsole_refresh, .flags = 0, .next = 0 }; void -pupa_console_init (void) +grub_console_init (void) { - pupa_term_register (&pupa_ofconsole_term); - pupa_term_set_current (&pupa_ofconsole_term); + grub_term_register (&grub_ofconsole_term); + grub_term_set_current (&grub_ofconsole_term); } diff --git a/util/console.c b/util/console.c index e139d7d6d..a0918f8b6 100644 --- a/util/console.c +++ b/util/console.c @@ -1,6 +1,6 @@ -/* console.c -- Ncurses console for PUPA. */ +/* console.c -- Ncurses console for GRUB. */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify @@ -19,31 +19,31 @@ */ #include -#include -#include -#include +#include +#include +#include -static int pupa_console_attr = A_NORMAL; +static int grub_console_attr = A_NORMAL; static void -pupa_ncurses_putchar (pupa_uint32_t c) +grub_ncurses_putchar (grub_uint32_t c) { - addch (c | pupa_console_attr); + addch (c | grub_console_attr); } static void -pupa_ncurses_setcolorstate (pupa_term_color_state state) +grub_ncurses_setcolorstate (grub_term_color_state state) { switch (state) { - case PUPA_TERM_COLOR_STANDARD: - pupa_console_attr = A_NORMAL; + case GRUB_TERM_COLOR_STANDARD: + grub_console_attr = A_NORMAL; break; - case PUPA_TERM_COLOR_NORMAL: - pupa_console_attr = A_NORMAL; + case GRUB_TERM_COLOR_NORMAL: + grub_console_attr = A_NORMAL; break; - case PUPA_TERM_COLOR_HIGHLIGHT: - pupa_console_attr = A_STANDOUT; + case GRUB_TERM_COLOR_HIGHLIGHT: + grub_console_attr = A_STANDOUT; break; default: break; @@ -52,77 +52,77 @@ pupa_ncurses_setcolorstate (pupa_term_color_state state) /* XXX: This function is never called. */ static void -pupa_ncurses_setcolor (pupa_uint8_t normal_color, pupa_uint8_t highlight_color) +grub_ncurses_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color) { color_set (normal_color << 8 | highlight_color, 0); } static int -pupa_ncurses_checkkey (void) +grub_ncurses_checkkey (void) { return 1; } static int -pupa_ncurses_getkey (void) +grub_ncurses_getkey (void) { int c = getch (); switch (c) { case KEY_LEFT: - c = PUPA_CONSOLE_KEY_LEFT; + c = GRUB_CONSOLE_KEY_LEFT; break; case KEY_RIGHT: - c = PUPA_CONSOLE_KEY_RIGHT; + c = GRUB_CONSOLE_KEY_RIGHT; break; case KEY_UP: - c = PUPA_CONSOLE_KEY_UP; + c = GRUB_CONSOLE_KEY_UP; break; case KEY_DOWN: - c = PUPA_CONSOLE_KEY_DOWN; + c = GRUB_CONSOLE_KEY_DOWN; break; case KEY_IC: - c = PUPA_CONSOLE_KEY_IC; + c = GRUB_CONSOLE_KEY_IC; break; case KEY_DC: - c = PUPA_CONSOLE_KEY_DC; + c = GRUB_CONSOLE_KEY_DC; break; case KEY_BACKSPACE: /* XXX: For some reason ncurses on xterm does not return KEY_BACKSPACE. */ case 127: - c = PUPA_CONSOLE_KEY_BACKSPACE; + c = GRUB_CONSOLE_KEY_BACKSPACE; break; case KEY_HOME: - c = PUPA_CONSOLE_KEY_HOME; + c = GRUB_CONSOLE_KEY_HOME; break; case KEY_END: - c = PUPA_CONSOLE_KEY_END; + c = GRUB_CONSOLE_KEY_END; break; case KEY_NPAGE: - c = PUPA_CONSOLE_KEY_NPAGE; + c = GRUB_CONSOLE_KEY_NPAGE; break; case KEY_PPAGE: - c = PUPA_CONSOLE_KEY_PPAGE; + c = GRUB_CONSOLE_KEY_PPAGE; break; } return c; } -static pupa_uint16_t -pupa_ncurses_getxy (void) +static grub_uint16_t +grub_ncurses_getxy (void) { int x; int y; @@ -133,32 +133,32 @@ pupa_ncurses_getxy (void) } static void -pupa_ncurses_gotoxy (pupa_uint8_t x, pupa_uint8_t y) +grub_ncurses_gotoxy (grub_uint8_t x, grub_uint8_t y) { move (y, x); } static void -pupa_ncurses_cls (void) +grub_ncurses_cls (void) { clear (); refresh (); } static void -pupa_ncurses_setcursor (int on) +grub_ncurses_setcursor (int on) { curs_set (on ? 1 : 0); } static void -pupa_ncurses_refresh (void) +grub_ncurses_refresh (void) { refresh (); } -static pupa_err_t -pupa_ncurses_init (void) +static grub_err_t +grub_ncurses_init (void) { initscr (); cbreak (); @@ -173,36 +173,36 @@ pupa_ncurses_init (void) return 0; } -static pupa_err_t -pupa_ncurses_fini (void) +static grub_err_t +grub_ncurses_fini (void) { endwin (); return 0; } -static struct pupa_term pupa_ncurses_term = +static struct grub_term grub_ncurses_term = { .name = "console", - .init = pupa_ncurses_init, - .fini = pupa_ncurses_fini, - .putchar = pupa_ncurses_putchar, - .checkkey = pupa_ncurses_checkkey, - .getkey = pupa_ncurses_getkey, - .getxy = pupa_ncurses_getxy, - .gotoxy = pupa_ncurses_gotoxy, - .cls = pupa_ncurses_cls, - .setcolorstate = pupa_ncurses_setcolorstate, - .setcolor = pupa_ncurses_setcolor, - .setcursor = pupa_ncurses_setcursor, - .refresh = pupa_ncurses_refresh, + .init = grub_ncurses_init, + .fini = grub_ncurses_fini, + .putchar = grub_ncurses_putchar, + .checkkey = grub_ncurses_checkkey, + .getkey = grub_ncurses_getkey, + .getxy = grub_ncurses_getxy, + .gotoxy = grub_ncurses_gotoxy, + .cls = grub_ncurses_cls, + .setcolorstate = grub_ncurses_setcolorstate, + .setcolor = grub_ncurses_setcolor, + .setcursor = grub_ncurses_setcursor, + .refresh = grub_ncurses_refresh, .flags = 0, .next = 0 }; void -pupa_console_init (void) +grub_console_init (void) { - pupa_term_register (&pupa_ncurses_term); - pupa_term_set_current (&pupa_ncurses_term); + grub_term_register (&grub_ncurses_term); + grub_term_set_current (&grub_ncurses_term); } diff --git a/util/genmoddep.c b/util/genmoddep.c index 38ed27b91..9edd06315 100644 --- a/util/genmoddep.c +++ b/util/genmoddep.c @@ -1,5 +1,5 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify diff --git a/util/grub-emu.c b/util/grub-emu.c index dc765f5c0..10c69f13c 100644 --- a/util/grub-emu.c +++ b/util/grub-emu.c @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ @@ -23,64 +23,64 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #ifdef __NetBSD__ /* NetBSD uses /boot for its boot block. */ -# define DEFAULT_DIRECTORY "/pupa" +# define DEFAULT_DIRECTORY "/grub" #else -# define DEFAULT_DIRECTORY "/boot/pupa" +# define DEFAULT_DIRECTORY "/boot/grub" #endif #define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map" /* XXX. */ -pupa_addr_t pupa_end_addr = -1; -pupa_addr_t pupa_total_module_size = 0; +grub_addr_t grub_end_addr = -1; +grub_addr_t grub_total_module_size = 0; int -pupa_arch_dl_check_header (void *ehdr, pupa_size_t size) +grub_arch_dl_check_header (void *ehdr, grub_size_t size) { (void) ehdr; (void) size; - return PUPA_ERR_BAD_MODULE; + return GRUB_ERR_BAD_MODULE; } -pupa_err_t -pupa_arch_dl_relocate_symbols (pupa_dl_t mod, void *ehdr) +grub_err_t +grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) { (void) mod; (void) ehdr; - return PUPA_ERR_BAD_MODULE; + return GRUB_ERR_BAD_MODULE; } void -pupa_machine_init (void) +grub_machine_init (void) { - pupa_console_init (); + grub_console_init (); } const char *argp_program_version = PACKAGE_STRING; const char *argp_program_bug_address = PACKAGE_BUGREPORT; -static char doc[] = "PUPA emulator"; +static char doc[] = "GRUB emulator"; static struct argp_option options[] = { {"root-device", 'r', "DEV", 0, "use DEV as the root device [default=guessed]", 0}, {"device-map", 'm', "FILE", 0, "use FILE as the device map", 0}, - {"directory", 'd', "DIR", 0, "use PUPA files in the directory DIR", 0}, + {"directory", 'd', "DIR", 0, "use GRUB files in the directory DIR", 0}, {"verbose", 'v', 0 , 0, "print verbose messages", 0}, { 0, 0, 0, 0, 0, 0 } }; @@ -138,46 +138,46 @@ main (int argc, char *argv[]) /* More sure there is a root device. */ if (! args.root_dev) { - args.root_dev = pupa_guess_root_device (args.dir ? : DEFAULT_DIRECTORY); + args.root_dev = grub_guess_root_device (args.dir ? : DEFAULT_DIRECTORY); if (! args.root_dev) { - pupa_util_info ("guessing the root device failed, because of `%s'", - pupa_errmsg); - pupa_util_error ("Cannot guess the root device. Specify the option ``--root-device''."); + grub_util_info ("guessing the root device failed, because of `%s'", + grub_errmsg); + grub_util_error ("Cannot guess the root device. Specify the option ``--root-device''."); } } - prefix = pupa_get_prefix (args.dir ? : DEFAULT_DIRECTORY); + prefix = grub_get_prefix (args.dir ? : DEFAULT_DIRECTORY); sprintf (rootprefix, "%s%s", args.root_dev, prefix); - pupa_env_set ("prefix", rootprefix); + grub_env_set ("prefix", rootprefix); /* XXX: This is a bit unportable. */ - pupa_util_biosdisk_init (args.dev_map); + grub_util_biosdisk_init (args.dev_map); /* Initialize the default modules. */ - pupa_fat_init (); - pupa_ext2_init (); - pupa_ls_init (); - pupa_boot_init (); - pupa_cmp_init (); - pupa_cat_init (); - pupa_terminal_init (); + grub_fat_init (); + grub_ext2_init (); + grub_ls_init (); + grub_boot_init (); + grub_cmp_init (); + grub_cat_init (); + grub_terminal_init (); /* XXX: Should normal mode be started by default? */ - pupa_normal_init (); + grub_normal_init (); - /* Start PUPA! */ - pupa_main (); + /* Start GRUB! */ + grub_main (); - pupa_util_biosdisk_fini (); - pupa_normal_fini (); - pupa_ext2_fini (); - pupa_fat_fini (); - pupa_boot_fini (); - pupa_cmp_fini (); - pupa_cat_fini (); - pupa_terminal_fini (); + grub_util_biosdisk_fini (); + grub_normal_fini (); + grub_ext2_fini (); + grub_fat_fini (); + grub_boot_fini (); + grub_cmp_fini (); + grub_cat_fini (); + grub_terminal_fini (); return 0; } diff --git a/util/i386/pc/biosdisk.c b/util/i386/pc/biosdisk.c index 76a879b5a..b9071f1cb 100644 --- a/util/i386/pc/biosdisk.c +++ b/util/i386/pc/biosdisk.c @@ -1,9 +1,9 @@ /* biosdisk.c - emulate biosdisk */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,16 +14,16 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include @@ -119,7 +119,7 @@ get_drive (const char *name) return (int) drive; fail: - pupa_error (PUPA_ERR_UNKNOWN_DEVICE, "not a biosdisk"); + grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a biosdisk"); return -1; } @@ -133,7 +133,7 @@ call_hook (int (*hook) (const char *name), int drive) } static int -pupa_util_biosdisk_iterate (int (*hook) (const char *name)) +grub_util_biosdisk_iterate (int (*hook) (const char *name)) { unsigned i; @@ -144,18 +144,18 @@ pupa_util_biosdisk_iterate (int (*hook) (const char *name)) return 0; } -static pupa_err_t -pupa_util_biosdisk_open (const char *name, pupa_disk_t disk) +static grub_err_t +grub_util_biosdisk_open (const char *name, grub_disk_t disk) { int drive; struct stat st; drive = get_drive (name); if (drive < 0) - return pupa_errno; + return grub_errno; if (! map[drive]) - return pupa_error (PUPA_ERR_BAD_DEVICE, + return grub_error (GRUB_ERR_BAD_DEVICE, "no mapping exists for `%s'", name); disk->has_partitions = (drive & 0x80); @@ -169,7 +169,7 @@ pupa_util_biosdisk_open (const char *name, pupa_disk_t disk) fd = open (map[drive], O_RDONLY); if (! fd) - return pupa_error (PUPA_ERR_BAD_DEVICE, "cannot open `%s'", map[drive]); + return grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s'", map[drive]); if (fstat (fd, &st) < 0 || ! S_ISBLK (st.st_mode)) { @@ -186,9 +186,9 @@ pupa_util_biosdisk_open (const char *name, pupa_disk_t disk) close (fd); disk->total_sectors = nr; - pupa_util_info ("the size of %s is %lu", name, disk->total_sectors); + grub_util_info ("the size of %s is %lu", name, disk->total_sectors); - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } fail: @@ -197,13 +197,13 @@ pupa_util_biosdisk_open (const char *name, pupa_disk_t disk) # warning "No special routine to get the size of a block device is implemented for your OS. This is not possibly fatal." #endif if (stat (map[drive], &st) < 0) - return pupa_error (PUPA_ERR_BAD_DEVICE, "cannot stat `%s'", map[drive]); + return grub_error (GRUB_ERR_BAD_DEVICE, "cannot stat `%s'", map[drive]); - disk->total_sectors = st.st_size >> PUPA_DISK_SECTOR_BITS; + disk->total_sectors = st.st_size >> GRUB_DISK_SECTOR_BITS; - pupa_util_info ("the size of %s is %lu", name, disk->total_sectors); + grub_util_info ("the size of %s is %lu", name, disk->total_sectors); - return PUPA_ERR_NONE; + return GRUB_ERR_NONE; } #ifdef __linux__ @@ -284,7 +284,7 @@ linux_find_partition (char *dev, unsigned long sector) #endif /* __linux__ */ static int -open_device (const pupa_disk_t disk, unsigned long sector, int flags) +open_device (const grub_disk_t disk, unsigned long sector, int flags) { int fd; @@ -310,11 +310,11 @@ open_device (const pupa_disk_t disk, unsigned long sector, int flags) is_partition = linux_find_partition (dev, disk->partition->start); /* Open the partition. */ - pupa_util_info ("opening the device `%s'", dev); + grub_util_info ("opening the device `%s'", dev); fd = open (dev, flags); if (fd < 0) { - pupa_error (PUPA_ERR_BAD_DEVICE, "cannot open `%s'", dev); + grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s'", dev); return -1; } @@ -328,7 +328,7 @@ open_device (const pupa_disk_t disk, unsigned long sector, int flags) fd = open (map[disk->id], flags); if (fd < 0) { - pupa_error (PUPA_ERR_BAD_DEVICE, "cannot open `%s'", map[disk->id]); + grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s'", map[disk->id]); return -1; } #endif /* ! __linux__ */ @@ -343,21 +343,21 @@ open_device (const pupa_disk_t disk, unsigned long sector, int flags) _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo, loff_t *, res, uint, wh); - offset = (loff_t) sector << PUPA_DISK_SECTOR_BITS; + offset = (loff_t) sector << GRUB_DISK_SECTOR_BITS; if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET)) { - pupa_error (PUPA_ERR_BAD_DEVICE, "cannot seek `%s'", map[disk->id]); + grub_error (GRUB_ERR_BAD_DEVICE, "cannot seek `%s'", map[disk->id]); close (fd); return -1; } } #else { - off_t offset = (off_t) sector << PUPA_DISK_SECTOR_BITS; + off_t offset = (off_t) sector << GRUB_DISK_SECTOR_BITS; if (lseek (fd, offset, SEEK_SET) != offset) { - pupa_error (PUPA_ERR_BAD_DEVICE, "cannot seek `%s'", map[disk->id]); + grub_error (GRUB_ERR_BAD_DEVICE, "cannot seek `%s'", map[disk->id]); close (fd); return -1; } @@ -419,15 +419,15 @@ nwrite (int fd, const char *buf, size_t len) return size; } -static pupa_err_t -pupa_util_biosdisk_read (pupa_disk_t disk, unsigned long sector, +static grub_err_t +grub_util_biosdisk_read (grub_disk_t disk, unsigned long sector, unsigned long size, char *buf) { int fd; fd = open_device (disk, sector, O_RDONLY); if (fd < 0) - return pupa_errno; + return grub_errno; #ifdef __linux__ if (sector == 0 && size > 1) @@ -436,52 +436,52 @@ pupa_util_biosdisk_read (pupa_disk_t disk, unsigned long sector, sectors that are read together with the MBR in one read. It should only remap the MBR, so we split the read in two parts. -jochen */ - if (nread (fd, buf, PUPA_DISK_SECTOR_SIZE) != PUPA_DISK_SECTOR_SIZE) + if (nread (fd, buf, GRUB_DISK_SECTOR_SIZE) != GRUB_DISK_SECTOR_SIZE) { - pupa_error (PUPA_ERR_READ_ERROR, "cannot read `%s'", map[disk->id]); + grub_error (GRUB_ERR_READ_ERROR, "cannot read `%s'", map[disk->id]); close (fd); - return pupa_errno; + return grub_errno; } - buf += PUPA_DISK_SECTOR_SIZE; + buf += GRUB_DISK_SECTOR_SIZE; size--; } #endif /* __linux__ */ - if (nread (fd, buf, size << PUPA_DISK_SECTOR_BITS) - != (ssize_t) (size << PUPA_DISK_SECTOR_BITS)) - pupa_error (PUPA_ERR_READ_ERROR, "cannot read from `%s'", map[disk->id]); + if (nread (fd, buf, size << GRUB_DISK_SECTOR_BITS) + != (ssize_t) (size << GRUB_DISK_SECTOR_BITS)) + grub_error (GRUB_ERR_READ_ERROR, "cannot read from `%s'", map[disk->id]); close (fd); - return pupa_errno; + return grub_errno; } -static pupa_err_t -pupa_util_biosdisk_write (pupa_disk_t disk, unsigned long sector, +static grub_err_t +grub_util_biosdisk_write (grub_disk_t disk, unsigned long sector, unsigned long size, const char *buf) { int fd; fd = open_device (disk, sector, O_WRONLY); if (fd < 0) - return pupa_errno; + return grub_errno; - if (nwrite (fd, buf, size << PUPA_DISK_SECTOR_BITS) - != (ssize_t) (size << PUPA_DISK_SECTOR_BITS)) - pupa_error (PUPA_ERR_WRITE_ERROR, "cannot write to `%s'", map[disk->id]); + if (nwrite (fd, buf, size << GRUB_DISK_SECTOR_BITS) + != (ssize_t) (size << GRUB_DISK_SECTOR_BITS)) + grub_error (GRUB_ERR_WRITE_ERROR, "cannot write to `%s'", map[disk->id]); close (fd); - return pupa_errno; + return grub_errno; } -static struct pupa_disk_dev pupa_util_biosdisk_dev = +static struct grub_disk_dev grub_util_biosdisk_dev = { .name = "biosdisk", - .iterate = pupa_util_biosdisk_iterate, - .open = pupa_util_biosdisk_open, + .iterate = grub_util_biosdisk_iterate, + .open = grub_util_biosdisk_open, .close = 0, - .read = pupa_util_biosdisk_read, - .write = pupa_util_biosdisk_write, + .read = grub_util_biosdisk_read, + .write = grub_util_biosdisk_write, .next = 0 }; @@ -495,12 +495,12 @@ read_device_map (const char *dev_map) void show_error (const char *msg) { - pupa_util_error ("%s:%d: %s", dev_map, lineno, msg); + grub_util_error ("%s:%d: %s", dev_map, lineno, msg); } fp = fopen (dev_map, "r"); if (! fp) - pupa_util_error ("Cannot open `%s'", dev_map); + grub_util_error ("Cannot open `%s'", dev_map); while (fgets (buf, sizeof (buf), fp)) { @@ -554,7 +554,7 @@ read_device_map (const char *dev_map) symbolic links. */ map[drive] = xmalloc (PATH_MAX); if (! realpath (p, map[drive])) - pupa_util_error ("Cannot get the real path of `%s'", p); + grub_util_error ("Cannot get the real path of `%s'", p); #else map[drive] = xstrdup (p); #endif @@ -564,21 +564,21 @@ read_device_map (const char *dev_map) } void -pupa_util_biosdisk_init (const char *dev_map) +grub_util_biosdisk_init (const char *dev_map) { read_device_map (dev_map); - pupa_disk_dev_register (&pupa_util_biosdisk_dev); + grub_disk_dev_register (&grub_util_biosdisk_dev); } void -pupa_util_biosdisk_fini (void) +grub_util_biosdisk_fini (void) { unsigned i; for (i = 0; i < sizeof (map) / sizeof (map[0]); i++) free (map[i]); - pupa_disk_dev_unregister (&pupa_util_biosdisk_dev); + grub_disk_dev_unregister (&grub_util_biosdisk_dev); } static char * @@ -697,21 +697,21 @@ find_drive (const char *os_dev) } char * -pupa_util_biosdisk_get_pupa_dev (const char *os_dev) +grub_util_biosdisk_get_grub_dev (const char *os_dev) { struct stat st; int drive; if (stat (os_dev, &st) < 0) { - pupa_error (PUPA_ERR_BAD_DEVICE, "cannot stat `%s'", os_dev); + grub_error (GRUB_ERR_BAD_DEVICE, "cannot stat `%s'", os_dev); return 0; } drive = find_drive (os_dev); if (drive < 0) { - pupa_error (PUPA_ERR_BAD_DEVICE, + grub_error (GRUB_ERR_BAD_DEVICE, "no mapping exists for `%s'", os_dev); return 0; } @@ -721,25 +721,25 @@ pupa_util_biosdisk_get_pupa_dev (const char *os_dev) #if defined(__linux__) /* Linux counts partitions uniformly, whether a BSD partition or a DOS - partition, so mapping them to PUPA devices is not trivial. + partition, so mapping them to GRUB devices is not trivial. Here, get the start sector of a partition by HDIO_GETGEO, and - compare it with each partition PUPA recognizes. */ + compare it with each partition GRUB recognizes. */ { char *name; - pupa_disk_t disk; + grub_disk_t disk; int fd; struct hd_geometry hdg; int dos_part = -1; int bsd_part = -1; - auto int find_partition (const pupa_partition_t partition); + auto int find_partition (const grub_partition_t partition); - int find_partition (const pupa_partition_t partition) + int find_partition (const grub_partition_t partition) { if (partition->bsd_part < 0) - pupa_util_info ("DOS partition %d starts from %lu", + grub_util_info ("DOS partition %d starts from %lu", partition->dos_part, partition->start); else - pupa_util_info ("BSD partition %d,%c starts from %lu", + grub_util_info ("BSD partition %d,%c starts from %lu", partition->dos_part, partition->bsd_part + 'a', partition->start); @@ -761,14 +761,14 @@ pupa_util_biosdisk_get_pupa_dev (const char *os_dev) fd = open (os_dev, O_RDONLY); if (! fd) { - pupa_error (PUPA_ERR_BAD_DEVICE, "cannot open `%s'", os_dev); + grub_error (GRUB_ERR_BAD_DEVICE, "cannot open `%s'", os_dev); free (name); return 0; } if (ioctl (fd, HDIO_GETGEO, &hdg)) { - pupa_error (PUPA_ERR_BAD_DEVICE, + grub_error (GRUB_ERR_BAD_DEVICE, "cannot get geometry of `%s'", os_dev); close (fd); free (name); @@ -777,28 +777,28 @@ pupa_util_biosdisk_get_pupa_dev (const char *os_dev) close (fd); - pupa_util_info ("%s starts from %lu", os_dev, hdg.start); + grub_util_info ("%s starts from %lu", os_dev, hdg.start); if (hdg.start == 0) return name; - pupa_util_info ("opening the device %s", name); - disk = pupa_disk_open (name); + grub_util_info ("opening the device %s", name); + disk = grub_disk_open (name); free (name); if (! disk) return 0; - if (pupa_partition_iterate (disk, find_partition) != PUPA_ERR_NONE) + if (grub_partition_iterate (disk, find_partition) != GRUB_ERR_NONE) { - pupa_disk_close (disk); + grub_disk_close (disk); return 0; } if (dos_part < 0) { - pupa_disk_close (disk); - pupa_error (PUPA_ERR_BAD_DEVICE, + grub_disk_close (disk); + grub_error (GRUB_ERR_BAD_DEVICE, "cannot find the partition of `%s'", os_dev); return 0; } @@ -834,7 +834,7 @@ pupa_util_biosdisk_get_pupa_dev (const char *os_dev) } #else -# warning "The function `pupa_util_biosdisk_get_pupa_dev' might not work on your OS correctly." +# warning "The function `grub_util_biosdisk_get_grub_dev' might not work on your OS correctly." return make_device_name (drive, -1, -1); #endif } diff --git a/util/i386/pc/getroot.c b/util/i386/pc/getroot.c index 7dbb2da39..a4a1426fe 100644 --- a/util/i386/pc/getroot.c +++ b/util/i386/pc/getroot.c @@ -1,9 +1,9 @@ /* getroot.c - Get root device */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 1999,2000,2001,2002,2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,7 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ @@ -23,8 +23,8 @@ #include #include -#include -#include +#include +#include static void strip_extra_slashes (char *dir) @@ -65,7 +65,7 @@ xgetcwd (void) } char * -pupa_get_prefix (const char *dir) +grub_get_prefix (const char *dir) { char *saved_cwd; char *abs_dir, *prev_dir; @@ -76,28 +76,28 @@ pupa_get_prefix (const char *dir) saved_cwd = xgetcwd (); if (chdir (dir) < 0) - pupa_util_error ("Cannot change directory to `%s'", dir); + 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) - pupa_util_error ("Cannot stat `%s'", dir); + grub_util_error ("Cannot stat `%s'", dir); if (! S_ISDIR (prev_st.st_mode)) - pupa_util_error ("`%s' is not a directory", dir); + grub_util_error ("`%s' is not a directory", dir); while (1) { if (chdir ("..") < 0) - pupa_util_error ("Cannot change directory to the parent"); + grub_util_error ("Cannot change directory to the parent"); if (stat (".", &st) < 0) - pupa_util_error ("Cannot stat current directory"); + grub_util_error ("Cannot stat current directory"); if (! S_ISDIR (st.st_mode)) - pupa_util_error ("Current directory is not a directory???"); + 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; @@ -114,13 +114,13 @@ pupa_get_prefix (const char *dir) strip_extra_slashes (prefix); if (chdir (saved_cwd) < 0) - pupa_util_error ("Cannot change directory to `%s'", dir); + grub_util_error ("Cannot change directory to `%s'", dir); free (saved_cwd); free (abs_dir); free (prev_dir); - pupa_util_info ("prefix = %s", prefix); + grub_util_info ("prefix = %s", prefix); return prefix; } @@ -137,7 +137,7 @@ find_root_device (const char *dir, dev_t dev) saved_cwd = xgetcwd (); - pupa_util_info ("changing current directory to %s", dir); + grub_util_info ("changing current directory to %s", dir); if (chdir (dir) < 0) { free (saved_cwd); @@ -170,7 +170,7 @@ find_root_device (const char *dir, dev_t dev) if (res) { if (chdir (saved_cwd) < 0) - pupa_util_error ("Cannot restore the original directory"); + grub_util_error ("Cannot restore the original directory"); free (saved_cwd); closedir (dp); @@ -191,7 +191,7 @@ find_root_device (const char *dir, dev_t dev) free (cwd); if (chdir (saved_cwd) < 0) - pupa_util_error ("Cannot restore the original directory"); + grub_util_error ("Cannot restore the original directory"); free (saved_cwd); closedir (dp); @@ -200,7 +200,7 @@ find_root_device (const char *dir, dev_t dev) } if (chdir (saved_cwd) < 0) - pupa_util_error ("Cannot restore the original directory"); + grub_util_error ("Cannot restore the original directory"); free (saved_cwd); closedir (dp); @@ -208,18 +208,18 @@ find_root_device (const char *dir, dev_t dev) } char * -pupa_guess_root_device (const char *dir) +grub_guess_root_device (const char *dir) { struct stat st; char *os_dev; if (stat (dir, &st) < 0) - pupa_util_error ("Cannot stat `%s'", dir); + grub_util_error ("Cannot stat `%s'", dir); /* This might be truly slow, but is there any better way? */ os_dev = find_root_device ("/dev", st.st_dev); if (! os_dev) return 0; - return pupa_util_biosdisk_get_pupa_dev (os_dev); + return grub_util_biosdisk_get_grub_dev (os_dev); } diff --git a/util/i386/pc/grub-mkimage.c b/util/i386/pc/grub-mkimage.c index be62a96da..1b683b738 100644 --- a/util/i386/pc/grub-mkimage.c +++ b/util/i386/pc/grub-mkimage.c @@ -1,9 +1,9 @@ -/* pupa-mkimage.c - make a bootable image */ +/* grub-mkimage.c - make a bootable image */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2003,2004 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,18 +14,18 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -44,69 +44,69 @@ compress_kernel (char *kernel_img, size_t kernel_size, lzo_uint size; char *wrkmem; - pupa_util_info ("kernel_img=%p, kernel_size=0x%x", kernel_img, kernel_size); - if (kernel_size < PUPA_KERNEL_MACHINE_RAW_SIZE) - pupa_util_error ("the core image is too small"); + grub_util_info ("kernel_img=%p, kernel_size=0x%x", kernel_img, kernel_size); + if (kernel_size < GRUB_KERNEL_MACHINE_RAW_SIZE) + grub_util_error ("the core image is too small"); if (lzo_init () != LZO_E_OK) - pupa_util_error ("cannot initialize LZO"); + grub_util_error ("cannot initialize LZO"); *core_img = xmalloc (kernel_size + kernel_size / 64 + 16 + 3); wrkmem = xmalloc (LZO1X_999_MEM_COMPRESS); - memcpy (*core_img, kernel_img, PUPA_KERNEL_MACHINE_RAW_SIZE); + memcpy (*core_img, kernel_img, GRUB_KERNEL_MACHINE_RAW_SIZE); - pupa_util_info ("compressing the core image"); - if (lzo1x_999_compress (kernel_img + PUPA_KERNEL_MACHINE_RAW_SIZE, - kernel_size - PUPA_KERNEL_MACHINE_RAW_SIZE, - *core_img + PUPA_KERNEL_MACHINE_RAW_SIZE, + grub_util_info ("compressing the core image"); + if (lzo1x_999_compress (kernel_img + GRUB_KERNEL_MACHINE_RAW_SIZE, + kernel_size - GRUB_KERNEL_MACHINE_RAW_SIZE, + *core_img + GRUB_KERNEL_MACHINE_RAW_SIZE, &size, wrkmem) != LZO_E_OK) - pupa_util_error ("cannot compress the kernel image"); + grub_util_error ("cannot compress the kernel image"); free (wrkmem); - *core_size = (size_t) size + PUPA_KERNEL_MACHINE_RAW_SIZE; + *core_size = (size_t) size + GRUB_KERNEL_MACHINE_RAW_SIZE; } static void generate_image (const char *dir, FILE *out, char *mods[]) { - pupa_addr_t module_addr = 0; + grub_addr_t module_addr = 0; char *kernel_img, *boot_img, *core_img; size_t kernel_size, boot_size, total_module_size, core_size; char *kernel_path, *boot_path; unsigned num; size_t offset; - struct pupa_util_path_list *path_list, *p, *next; + struct grub_util_path_list *path_list, *p, *next; - path_list = pupa_util_resolve_dependencies (dir, "moddep.lst", mods); + path_list = grub_util_resolve_dependencies (dir, "moddep.lst", mods); - kernel_path = pupa_util_get_path (dir, "kernel.img"); - kernel_size = pupa_util_get_image_size (kernel_path); + kernel_path = grub_util_get_path (dir, "kernel.img"); + kernel_size = grub_util_get_image_size (kernel_path); total_module_size = 0; for (p = path_list; p; p = p->next) - total_module_size += (pupa_util_get_image_size (p->name) - + sizeof (struct pupa_module_header)); + total_module_size += (grub_util_get_image_size (p->name) + + sizeof (struct grub_module_header)); - pupa_util_info ("the total module size is 0x%x", total_module_size); + grub_util_info ("the total module size is 0x%x", total_module_size); kernel_img = xmalloc (kernel_size + total_module_size); - pupa_util_load_image (kernel_path, kernel_img); + grub_util_load_image (kernel_path, kernel_img); offset = kernel_size; for (p = path_list; p; p = p->next) { - struct pupa_module_header *header; + struct grub_module_header *header; size_t mod_size; - mod_size = pupa_util_get_image_size (p->name); + mod_size = grub_util_get_image_size (p->name); - header = (struct pupa_module_header *) (kernel_img + offset); - header->offset = pupa_cpu_to_le32 (sizeof (*header)); - header->size = pupa_cpu_to_le32 (mod_size + sizeof (*header)); + header = (struct grub_module_header *) (kernel_img + offset); + header->offset = grub_cpu_to_le32 (sizeof (*header)); + header->size = grub_cpu_to_le32 (mod_size + sizeof (*header)); - pupa_util_load_image (p->name, kernel_img + offset + sizeof (*header)); + grub_util_load_image (p->name, kernel_img + offset + sizeof (*header)); offset += sizeof (*header) + mod_size; } @@ -114,42 +114,42 @@ generate_image (const char *dir, FILE *out, char *mods[]) compress_kernel (kernel_img, kernel_size + total_module_size, &core_img, &core_size); - pupa_util_info ("the core size is 0x%x", core_size); + grub_util_info ("the core size is 0x%x", core_size); - num = ((core_size + PUPA_DISK_SECTOR_SIZE - 1) >> PUPA_DISK_SECTOR_BITS); + num = ((core_size + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS); if (num > 0xffff) - pupa_util_error ("the core image is too big"); + grub_util_error ("the core image is too big"); - boot_path = pupa_util_get_path (dir, "diskboot.img"); - boot_size = pupa_util_get_image_size (boot_path); - if (boot_size != PUPA_DISK_SECTOR_SIZE) - pupa_util_error ("diskboot.img is not one sector size"); + boot_path = grub_util_get_path (dir, "diskboot.img"); + boot_size = grub_util_get_image_size (boot_path); + if (boot_size != GRUB_DISK_SECTOR_SIZE) + grub_util_error ("diskboot.img is not one sector size"); - boot_img = pupa_util_read_image (boot_path); + boot_img = grub_util_read_image (boot_path); /* i386 is a little endian architecture. */ - *((pupa_uint16_t *) (boot_img + PUPA_DISK_SECTOR_SIZE - - PUPA_BOOT_MACHINE_LIST_SIZE + 4)) - = pupa_cpu_to_le16 (num); + *((grub_uint16_t *) (boot_img + GRUB_DISK_SECTOR_SIZE + - GRUB_BOOT_MACHINE_LIST_SIZE + 4)) + = grub_cpu_to_le16 (num); - pupa_util_write_image (boot_img, boot_size, out); + grub_util_write_image (boot_img, boot_size, out); free (boot_img); free (boot_path); module_addr = (path_list - ? (PUPA_BOOT_MACHINE_KERNEL_ADDR + PUPA_DISK_SECTOR_SIZE + ? (GRUB_BOOT_MACHINE_KERNEL_ADDR + GRUB_DISK_SECTOR_SIZE + kernel_size) : 0); - pupa_util_info ("the first module address is 0x%x", module_addr); - *((pupa_uint32_t *) (core_img + PUPA_KERNEL_MACHINE_TOTAL_MODULE_SIZE)) - = pupa_cpu_to_le32 (total_module_size); - *((pupa_uint32_t *) (core_img + PUPA_KERNEL_MACHINE_KERNEL_IMAGE_SIZE)) - = pupa_cpu_to_le32 (kernel_size); - *((pupa_uint32_t *) (core_img + PUPA_KERNEL_MACHINE_COMPRESSED_SIZE)) - = pupa_cpu_to_le32 (core_size - PUPA_KERNEL_MACHINE_RAW_SIZE); + grub_util_info ("the first module address is 0x%x", module_addr); + *((grub_uint32_t *) (core_img + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE)) + = grub_cpu_to_le32 (total_module_size); + *((grub_uint32_t *) (core_img + GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE)) + = grub_cpu_to_le32 (kernel_size); + *((grub_uint32_t *) (core_img + GRUB_KERNEL_MACHINE_COMPRESSED_SIZE)) + = grub_cpu_to_le32 (core_size - GRUB_KERNEL_MACHINE_RAW_SIZE); - pupa_util_write_image (core_img, core_size, out); + grub_util_write_image (core_img, core_size, out); free (kernel_img); free (core_img); free (kernel_path); @@ -179,12 +179,12 @@ static void usage (int status) { if (status) - fprintf (stderr, "Try ``pupa-mkimage --help'' for more information.\n"); + fprintf (stderr, "Try ``grub-mkimage --help'' for more information.\n"); else printf ("\ -Usage: pupa-mkimage [OPTION]... [MODULES]\n\ +Usage: grub-mkimage [OPTION]... [MODULES]\n\ \n\ -Make a bootable image of PUPA.\n\ +Make a bootable image of GRUB.\n\ \n\ -d, --directory=DIR use images and modules under DIR [default=%s]\n\ -o, --output=FILE output a generated image to FILE [default=stdout]\n\ @@ -193,7 +193,7 @@ Make a bootable image of PUPA.\n\ -v, --verbose print verbose messages\n\ \n\ Report bugs to <%s>.\n\ -", PUPA_DATADIR, PACKAGE_BUGREPORT); +", GRUB_DATADIR, PACKAGE_BUGREPORT); exit (status); } @@ -205,7 +205,7 @@ main (int argc, char *argv[]) char *dir = 0; FILE *fp = stdout; - progname = "pupa-mkimage"; + progname = "grub-mkimage"; while (1) { @@ -235,7 +235,7 @@ main (int argc, char *argv[]) break; case 'V': - printf ("pupa-mkimage (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); + printf ("grub-mkimage (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); return 0; case 'v': @@ -252,10 +252,10 @@ main (int argc, char *argv[]) { fp = fopen (output, "wb"); if (! fp) - pupa_util_error ("cannot open %s", output); + grub_util_error ("cannot open %s", output); } - generate_image (dir ? : PUPA_DATADIR, fp, argv + optind); + generate_image (dir ? : GRUB_DATADIR, fp, argv + optind); fclose (fp); diff --git a/util/i386/pc/grub-setup.c b/util/i386/pc/grub-setup.c index 587472ca6..37a306619 100644 --- a/util/i386/pc/grub-setup.c +++ b/util/i386/pc/grub-setup.c @@ -1,9 +1,9 @@ -/* pupa-setup.c - make PUPA usable */ +/* grub-setup.c - make GRUB usable */ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -14,21 +14,21 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -37,7 +37,7 @@ #include #include #include -#include +#include #define _GNU_SOURCE 1 #include @@ -47,9 +47,9 @@ #ifdef __NetBSD__ /* NetBSD uses /boot for its boot block. */ -# define DEFAULT_DIRECTORY "/pupa" +# define DEFAULT_DIRECTORY "/grub" #else -# define DEFAULT_DIRECTORY "/boot/pupa" +# define DEFAULT_DIRECTORY "/boot/grub" #endif #define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map" @@ -57,19 +57,19 @@ /* This is the blocklist used in the diskboot image. */ struct boot_blocklist { - pupa_uint32_t start; - pupa_uint16_t len; - pupa_uint16_t segment; + grub_uint32_t start; + grub_uint16_t len; + grub_uint16_t segment; } __attribute__ ((packed)); void -pupa_putchar (int c) +grub_putchar (int c) { putchar (c); } void -pupa_refresh (void) +grub_refresh (void) { } @@ -81,20 +81,20 @@ setup (const char *prefix, const char *dir, char *boot_path, *core_path; char *boot_img, *core_img; size_t boot_size, core_size; - pupa_uint16_t core_sectors; - pupa_device_t root_dev, dest_dev; - pupa_uint8_t *boot_drive; - pupa_uint32_t *kernel_sector; + grub_uint16_t core_sectors; + grub_device_t root_dev, dest_dev; + grub_uint8_t *boot_drive; + grub_uint32_t *kernel_sector; struct boot_blocklist *first_block, *block; - pupa_int32_t *install_dos_part, *install_bsd_part; + grub_int32_t *install_dos_part, *install_bsd_part; char *install_prefix; char *tmp_img; int i; unsigned long first_sector; - pupa_uint16_t current_segment - = PUPA_BOOT_MACHINE_KERNEL_SEG + (PUPA_DISK_SECTOR_SIZE >> 4); - pupa_uint16_t last_length = PUPA_DISK_SECTOR_SIZE; - pupa_file_t file; + grub_uint16_t current_segment + = GRUB_BOOT_MACHINE_KERNEL_SEG + (GRUB_DISK_SECTOR_SIZE >> 4); + grub_uint16_t last_length = GRUB_DISK_SECTOR_SIZE; + grub_file_t file; FILE *fp; unsigned long first_start = ~0UL; @@ -103,12 +103,12 @@ setup (const char *prefix, const char *dir, auto void save_blocklists (unsigned long sector, unsigned offset, unsigned length); - auto int find_first_partition_start (const pupa_partition_t p); + auto int find_first_partition_start (const grub_partition_t p); - int find_first_partition_start (const pupa_partition_t p) + int find_first_partition_start (const grub_partition_t p) { - if (! pupa_partition_is_empty (p->dos_type) - && ! pupa_partition_is_bsd (p->dos_type) + if (! grub_partition_is_empty (p->dos_type) + && ! grub_partition_is_bsd (p->dos_type) && first_start > p->start) first_start = p->start; @@ -118,11 +118,11 @@ setup (const char *prefix, const char *dir, void save_first_sector (unsigned long sector, unsigned offset, unsigned length) { - pupa_util_info ("the fist sector is <%lu,%u,%u>", + grub_util_info ("the fist sector is <%lu,%u,%u>", sector, offset, length); - if (offset != 0 || length != PUPA_DISK_SECTOR_SIZE) - pupa_util_error ("The first sector of the core file is not sector-aligned"); + if (offset != 0 || length != GRUB_DISK_SECTOR_SIZE) + grub_util_error ("The first sector of the core file is not sector-aligned"); first_sector = sector; } @@ -131,97 +131,97 @@ setup (const char *prefix, const char *dir, { struct boot_blocklist *prev = block + 1; - pupa_util_info ("saving <%lu,%u,%u> with the segment 0x%x", + grub_util_info ("saving <%lu,%u,%u> with the segment 0x%x", sector, offset, length, (unsigned) current_segment); - if (offset != 0 || last_length != PUPA_DISK_SECTOR_SIZE) - pupa_util_error ("Non-sector-aligned data is found in the core file"); + if (offset != 0 || last_length != GRUB_DISK_SECTOR_SIZE) + grub_util_error ("Non-sector-aligned data is found in the core file"); if (block != first_block - && (pupa_le_to_cpu32 (prev->start) - + pupa_le_to_cpu16 (prev->len)) == sector) - prev->len = pupa_cpu_to_le16 (pupa_le_to_cpu16 (prev->len) + 1); + && (grub_le_to_cpu32 (prev->start) + + grub_le_to_cpu16 (prev->len)) == sector) + prev->len = grub_cpu_to_le16 (grub_le_to_cpu16 (prev->len) + 1); else { - block->start = pupa_cpu_to_le32 (sector); - block->len = pupa_cpu_to_le16 (1); - block->segment = pupa_cpu_to_le16 (current_segment); + block->start = grub_cpu_to_le32 (sector); + block->len = grub_cpu_to_le16 (1); + block->segment = grub_cpu_to_le16 (current_segment); block--; if (block->len) - pupa_util_error ("The sectors of the core file are too fragmented"); + grub_util_error ("The sectors of the core file are too fragmented"); } last_length = length; - current_segment += PUPA_DISK_SECTOR_SIZE >> 4; + current_segment += GRUB_DISK_SECTOR_SIZE >> 4; } /* Read the boot image by the OS service. */ - boot_path = pupa_util_get_path (dir, boot_file); - boot_size = pupa_util_get_image_size (boot_path); - if (boot_size != PUPA_DISK_SECTOR_SIZE) - pupa_util_error ("The size of `%s' is not %d", - boot_path, PUPA_DISK_SECTOR_SIZE); - boot_img = pupa_util_read_image (boot_path); + boot_path = grub_util_get_path (dir, boot_file); + boot_size = grub_util_get_image_size (boot_path); + if (boot_size != GRUB_DISK_SECTOR_SIZE) + grub_util_error ("The size of `%s' is not %d", + boot_path, GRUB_DISK_SECTOR_SIZE); + boot_img = grub_util_read_image (boot_path); free (boot_path); /* Set the addresses of BOOT_DRIVE and KERNEL_SECTOR. */ - boot_drive = (pupa_uint8_t *) (boot_img + PUPA_BOOT_MACHINE_BOOT_DRIVE); - kernel_sector = (pupa_uint32_t *) (boot_img - + PUPA_BOOT_MACHINE_KERNEL_SECTOR); + boot_drive = (grub_uint8_t *) (boot_img + GRUB_BOOT_MACHINE_BOOT_DRIVE); + kernel_sector = (grub_uint32_t *) (boot_img + + GRUB_BOOT_MACHINE_KERNEL_SECTOR); - core_path = pupa_util_get_path (dir, core_file); - core_size = pupa_util_get_image_size (core_path); - core_sectors = ((core_size + PUPA_DISK_SECTOR_SIZE - 1) - >> PUPA_DISK_SECTOR_BITS); - if (core_size < PUPA_DISK_SECTOR_SIZE) - pupa_util_error ("The size of `%s' is too small", core_path); - else if (core_size > 0xFFFF * PUPA_DISK_SECTOR_SIZE) - pupa_util_error ("The size of `%s' is too large", core_path); + core_path = grub_util_get_path (dir, core_file); + core_size = grub_util_get_image_size (core_path); + core_sectors = ((core_size + GRUB_DISK_SECTOR_SIZE - 1) + >> GRUB_DISK_SECTOR_BITS); + if (core_size < GRUB_DISK_SECTOR_SIZE) + grub_util_error ("The size of `%s' is too small", core_path); + else if (core_size > 0xFFFF * GRUB_DISK_SECTOR_SIZE) + grub_util_error ("The size of `%s' is too large", core_path); - core_img = pupa_util_read_image (core_path); + core_img = grub_util_read_image (core_path); free (core_path); /* Have FIRST_BLOCK to point to the first blocklist. */ first_block = (struct boot_blocklist *) (core_img - + PUPA_DISK_SECTOR_SIZE + + GRUB_DISK_SECTOR_SIZE - sizeof (*block)); - install_dos_part = (pupa_int32_t *) (core_img + PUPA_DISK_SECTOR_SIZE - + PUPA_KERNEL_MACHINE_INSTALL_DOS_PART); - install_bsd_part = (pupa_int32_t *) (core_img + PUPA_DISK_SECTOR_SIZE - + PUPA_KERNEL_MACHINE_INSTALL_BSD_PART); - install_prefix = (core_img + PUPA_DISK_SECTOR_SIZE - + PUPA_KERNEL_MACHINE_PREFIX); + install_dos_part = (grub_int32_t *) (core_img + GRUB_DISK_SECTOR_SIZE + + GRUB_KERNEL_MACHINE_INSTALL_DOS_PART); + install_bsd_part = (grub_int32_t *) (core_img + GRUB_DISK_SECTOR_SIZE + + GRUB_KERNEL_MACHINE_INSTALL_BSD_PART); + install_prefix = (core_img + GRUB_DISK_SECTOR_SIZE + + GRUB_KERNEL_MACHINE_PREFIX); /* Open the root device and the destination device. */ - root_dev = pupa_device_open (root); + root_dev = grub_device_open (root); if (! root_dev) - pupa_util_error ("%s", pupa_errmsg); + grub_util_error ("%s", grub_errmsg); - dest_dev = pupa_device_open (dest); + dest_dev = grub_device_open (dest); if (! dest_dev) - pupa_util_error ("%s", pupa_errmsg); + grub_util_error ("%s", grub_errmsg); - pupa_util_info ("setting the root device to `%s'", root); - if (pupa_device_set_root (root) != PUPA_ERR_NONE) - pupa_util_error ("%s", pupa_errmsg); + grub_util_info ("setting the root device to `%s'", root); + if (grub_device_set_root (root) != GRUB_ERR_NONE) + grub_util_error ("%s", grub_errmsg); /* Read the original sector from the disk. */ - tmp_img = xmalloc (PUPA_DISK_SECTOR_SIZE); - if (pupa_disk_read (dest_dev->disk, 0, 0, PUPA_DISK_SECTOR_SIZE, tmp_img)) - pupa_util_error ("%s", pupa_errmsg); + tmp_img = xmalloc (GRUB_DISK_SECTOR_SIZE); + if (grub_disk_read (dest_dev->disk, 0, 0, GRUB_DISK_SECTOR_SIZE, tmp_img)) + grub_util_error ("%s", grub_errmsg); /* Copy the possible DOS BPB. */ - memcpy (boot_img + PUPA_BOOT_MACHINE_BPB_START, - tmp_img + PUPA_BOOT_MACHINE_BPB_START, - PUPA_BOOT_MACHINE_BPB_END - PUPA_BOOT_MACHINE_BPB_START); + memcpy (boot_img + GRUB_BOOT_MACHINE_BPB_START, + tmp_img + GRUB_BOOT_MACHINE_BPB_START, + GRUB_BOOT_MACHINE_BPB_END - GRUB_BOOT_MACHINE_BPB_START); /* Copy the possible partition table. */ if (dest_dev->disk->has_partitions) - memcpy (boot_img + PUPA_BOOT_MACHINE_WINDOWS_NT_MAGIC, - tmp_img + PUPA_BOOT_MACHINE_WINDOWS_NT_MAGIC, - PUPA_BOOT_MACHINE_PART_END - PUPA_BOOT_MACHINE_WINDOWS_NT_MAGIC); + memcpy (boot_img + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC, + tmp_img + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC, + GRUB_BOOT_MACHINE_PART_END - GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC); free (tmp_img); @@ -229,19 +229,19 @@ setup (const char *prefix, const char *dir, try to embed the core image into after the MBR. */ if (dest_dev->disk->has_partitions && ! dest_dev->disk->partition) { - pupa_partition_iterate (dest_dev->disk, find_first_partition_start); + grub_partition_iterate (dest_dev->disk, find_first_partition_start); /* If there is enough space... */ if ((unsigned long) core_sectors + 1 <= first_start) { - pupa_util_info ("will embed the core image into after the MBR"); + grub_util_info ("will embed the core image into after the MBR"); /* The first blocklist contains the whole sectors. */ - first_block->start = pupa_cpu_to_le32 (2); - first_block->len = pupa_cpu_to_le16 (core_sectors - 1); + first_block->start = grub_cpu_to_le32 (2); + first_block->len = grub_cpu_to_le16 (core_sectors - 1); first_block->segment - = pupa_cpu_to_le16 (PUPA_BOOT_MACHINE_KERNEL_SEG - + (PUPA_DISK_SECTOR_SIZE >> 4)); + = grub_cpu_to_le16 (GRUB_BOOT_MACHINE_KERNEL_SEG + + (GRUB_DISK_SECTOR_SIZE >> 4)); /* Make sure that the second blocklist is a terminator. */ block = first_block - 1; @@ -253,39 +253,39 @@ setup (const char *prefix, const char *dir, if (root_dev->disk->partition) { *install_dos_part - = pupa_cpu_to_le32 (root_dev->disk->partition->dos_part); + = grub_cpu_to_le32 (root_dev->disk->partition->dos_part); *install_bsd_part - = pupa_cpu_to_le32 (root_dev->disk->partition->bsd_part); + = grub_cpu_to_le32 (root_dev->disk->partition->bsd_part); } else - *install_dos_part = *install_bsd_part = pupa_cpu_to_le32 (-1); + *install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-1); strcpy (install_prefix, prefix); /* Write the core image onto the disk. */ - if (pupa_disk_write (dest_dev->disk, 1, 0, core_size, core_img)) - pupa_util_error ("%s", pupa_errmsg); + if (grub_disk_write (dest_dev->disk, 1, 0, core_size, core_img)) + grub_util_error ("%s", grub_errmsg); /* The boot image and the core image are on the same drive, so there is no need to specify the boot drive explicitly. */ *boot_drive = 0xff; - *kernel_sector = pupa_cpu_to_le32 (1); + *kernel_sector = grub_cpu_to_le32 (1); /* Write the boot image onto the disk. */ - if (pupa_disk_write (dest_dev->disk, 0, 0, PUPA_DISK_SECTOR_SIZE, + if (grub_disk_write (dest_dev->disk, 0, 0, GRUB_DISK_SECTOR_SIZE, boot_img)) - pupa_util_error ("%s", pupa_errmsg); + grub_util_error ("%s", grub_errmsg); goto finish; } } /* The core image must be put on a filesystem unfortunately. */ - pupa_util_info ("will leave the core image on the filesystem"); + grub_util_info ("will leave the core image on the filesystem"); - /* Make sure that PUPA reads the identical image as the OS. */ + /* Make sure that GRUB reads the identical image as the OS. */ tmp_img = xmalloc (core_size); - core_path = pupa_util_get_path (prefix, core_file); + core_path = grub_util_get_path (prefix, core_file); /* It is a Good Thing to sync two times. */ sync (); @@ -295,20 +295,20 @@ setup (const char *prefix, const char *dir, for (i = 0; i < MAX_TRIES; i++) { - pupa_util_info ("attempting to read the core image `%s' from PUPA%s", + grub_util_info ("attempting to read the core image `%s' from GRUB%s", core_path, (i == 0) ? "" : " again"); - pupa_disk_cache_invalidate_all (); + grub_disk_cache_invalidate_all (); - file = pupa_file_open (core_path); + file = grub_file_open (core_path); if (file) { - if (pupa_file_size (file) != (pupa_ssize_t) core_size) - pupa_util_info ("succeeded in opening the core image but the size is different (%d != %d)", - (int) pupa_file_size (file), (int) core_size); - else if (pupa_file_read (file, tmp_img, core_size) - != (pupa_ssize_t) core_size) - pupa_util_info ("succeeded in opening the core image but cannot read %d bytes", + if (grub_file_size (file) != (grub_ssize_t) core_size) + grub_util_info ("succeeded in opening the core image but the size is different (%d != %d)", + (int) grub_file_size (file), (int) core_size); + else if (grub_file_read (file, tmp_img, core_size) + != (grub_ssize_t) core_size) + grub_util_info ("succeeded in opening the core image but cannot read %d bytes", (int) core_size); else if (memcmp (core_img, tmp_img, core_size) != 0) { @@ -331,29 +331,29 @@ setup (const char *prefix, const char *dir, } #endif - pupa_util_info ("succeeded in opening the core image but the data is different"); + grub_util_info ("succeeded in opening the core image but the data is different"); } else { - pupa_file_close (file); + grub_file_close (file); break; } - pupa_file_close (file); + grub_file_close (file); } else - pupa_util_info ("couldn't open the core image"); + grub_util_info ("couldn't open the core image"); - if (pupa_errno) - pupa_util_info ("error message = %s", pupa_errmsg); + if (grub_errno) + grub_util_info ("error message = %s", grub_errmsg); - pupa_errno = PUPA_ERR_NONE; + grub_errno = GRUB_ERR_NONE; sync (); sleep (1); } if (i == MAX_TRIES) - pupa_util_error ("Cannot read `%s' correctly", core_path); + grub_util_error ("Cannot read `%s' correctly", core_path); /* Clean out the blocklists. */ block = first_block; @@ -366,34 +366,34 @@ setup (const char *prefix, const char *dir, block--; if ((char *) block <= core_img) - pupa_util_error ("No terminator in the core image"); + grub_util_error ("No terminator in the core image"); } /* Now read the core image to determine where the sectors are. */ - file = pupa_file_open (core_path); + file = grub_file_open (core_path); if (! file) - pupa_util_error ("%s", pupa_errmsg); + grub_util_error ("%s", grub_errmsg); file->read_hook = save_first_sector; - if (pupa_file_read (file, tmp_img, PUPA_DISK_SECTOR_SIZE) - != PUPA_DISK_SECTOR_SIZE) - pupa_util_error ("Failed to read the first sector of the core image"); + if (grub_file_read (file, tmp_img, GRUB_DISK_SECTOR_SIZE) + != GRUB_DISK_SECTOR_SIZE) + grub_util_error ("Failed to read the first sector of the core image"); block = first_block; file->read_hook = save_blocklists; - if (pupa_file_read (file, tmp_img, core_size - PUPA_DISK_SECTOR_SIZE) - != (pupa_ssize_t) core_size - PUPA_DISK_SECTOR_SIZE) - pupa_util_error ("Failed to read the rest sectors of the core image"); + if (grub_file_read (file, tmp_img, core_size - GRUB_DISK_SECTOR_SIZE) + != (grub_ssize_t) core_size - GRUB_DISK_SECTOR_SIZE) + grub_util_error ("Failed to read the rest sectors of the core image"); free (core_path); free (tmp_img); - *kernel_sector = pupa_cpu_to_le32 (first_sector); + *kernel_sector = grub_cpu_to_le32 (first_sector); /* If the destination device is different from the root device, it is necessary to embed the boot drive explicitly. */ if (root_dev->disk->id != dest_dev->disk->id) - *boot_drive = (pupa_uint8_t) root_dev->disk->id; + *boot_drive = (grub_uint8_t) root_dev->disk->id; else *boot_drive = 0xFF; @@ -401,29 +401,29 @@ setup (const char *prefix, const char *dir, if (root_dev->disk->partition) { *install_dos_part - = pupa_cpu_to_le32 (root_dev->disk->partition->dos_part); + = grub_cpu_to_le32 (root_dev->disk->partition->dos_part); *install_bsd_part - = pupa_cpu_to_le32 (root_dev->disk->partition->bsd_part); + = grub_cpu_to_le32 (root_dev->disk->partition->bsd_part); } else - *install_dos_part = *install_bsd_part = pupa_cpu_to_le32 (-1); + *install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-1); strcpy (install_prefix, prefix); /* Write the first two sectors of the core image onto the disk. */ - core_path = pupa_util_get_path (dir, core_file); - pupa_util_info ("opening the core image `%s'", core_path); + core_path = grub_util_get_path (dir, core_file); + grub_util_info ("opening the core image `%s'", core_path); fp = fopen (core_path, "r+b"); if (! fp) - pupa_util_error ("Cannot open `%s'", core_path); + grub_util_error ("Cannot open `%s'", core_path); - pupa_util_write_image (core_img, PUPA_DISK_SECTOR_SIZE * 2, fp); + grub_util_write_image (core_img, GRUB_DISK_SECTOR_SIZE * 2, fp); fclose (fp); free (core_path); /* Write the boot image onto the disk. */ - if (pupa_disk_write (dest_dev->disk, 0, 0, PUPA_DISK_SECTOR_SIZE, boot_img)) - pupa_util_error ("%s", pupa_errmsg); + if (grub_disk_write (dest_dev->disk, 0, 0, GRUB_DISK_SECTOR_SIZE, boot_img)) + grub_util_error ("%s", grub_errmsg); finish: @@ -432,8 +432,8 @@ setup (const char *prefix, const char *dir, free (core_img); free (boot_img); - pupa_device_close (dest_dev); - pupa_device_close (root_dev); + grub_device_close (dest_dev); + grub_device_close (root_dev); } static struct option options[] = @@ -453,17 +453,17 @@ static void usage (int status) { if (status) - fprintf (stderr, "Try ``pupa-setup --help'' for more information.\n"); + fprintf (stderr, "Try ``grub-setup --help'' for more information.\n"); else printf ("\ -Usage: pupa-setup [OPTION]... DEVICE\n\ +Usage: grub-setup [OPTION]... DEVICE\n\ \n\ Set up images to boot from DEVICE.\n\ -DEVICE must be a PUPA device (e.g. ``(hd0,0)'').\n\ +DEVICE must be a GRUB device (e.g. ``(hd0,0)'').\n\ \n\ -b, --boot-file=FILE use FILE as the boot file [default=%s]\n\ -c, --core-file=FILE use FILE as the core file [default=%s]\n\ - -d, --directory=DIR use PUPA files in the directory DIR [default=%s]\n\ + -d, --directory=DIR use GRUB files in the directory DIR [default=%s]\n\ -m, --device-map=FILE use FILE as the device map [default=%s]\n\ -r, --root-device=DEV use DEV as the root device [default=guessed]\n\ -h, --help display this message and exit\n\ @@ -501,7 +501,7 @@ main (int argc, char *argv[]) char *prefix; char *dest_dev; - progname = "pupa-setup"; + progname = "grub-setup"; /* Check for options. */ while (1) @@ -553,7 +553,7 @@ main (int argc, char *argv[]) break; case 'V': - printf ("pupa-setup (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); + printf ("grub-setup (%s) %s\n", PACKAGE_NAME, PACKAGE_VERSION); return 0; case 'v': @@ -587,21 +587,21 @@ main (int argc, char *argv[]) usage (1); } - prefix = pupa_get_prefix (dir ? : DEFAULT_DIRECTORY); + prefix = grub_get_prefix (dir ? : DEFAULT_DIRECTORY); /* Initialize the emulated biosdisk driver. */ - pupa_util_biosdisk_init (dev_map ? : DEFAULT_DEVICE_MAP); + grub_util_biosdisk_init (dev_map ? : DEFAULT_DEVICE_MAP); /* Initialize filesystems. */ - pupa_fat_init (); - pupa_ext2_init (); + grub_fat_init (); + grub_ext2_init (); if (root_dev) { char *tmp = get_device_name (root_dev); if (! tmp) - pupa_util_error ("Invalid root device `%s'", root_dev); + grub_util_error ("Invalid root device `%s'", root_dev); tmp = xstrdup (tmp); free (root_dev); @@ -609,12 +609,12 @@ main (int argc, char *argv[]) } else { - root_dev = pupa_guess_root_device (dir ? : DEFAULT_DIRECTORY); + root_dev = grub_guess_root_device (dir ? : DEFAULT_DIRECTORY); if (! root_dev) { - pupa_util_info ("guessing the root device failed, because of `%s'", - pupa_errmsg); - pupa_util_error ("Cannot guess the root device. Specify the option ``--root-device''."); + grub_util_info ("guessing the root device failed, because of `%s'", + grub_errmsg); + grub_util_error ("Cannot guess the root device. Specify the option ``--root-device''."); } } @@ -626,10 +626,10 @@ main (int argc, char *argv[]) root_dev, dest_dev); /* Free resources. */ - pupa_ext2_fini (); - pupa_fat_fini (); + grub_ext2_fini (); + grub_fat_fini (); - pupa_util_biosdisk_fini (); + grub_util_biosdisk_fini (); free (boot_file); free (core_file); diff --git a/util/misc.c b/util/misc.c index ac2415258..da04d51c1 100644 --- a/util/misc.c +++ b/util/misc.c @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002,2003 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ @@ -26,15 +26,15 @@ #include #include -#include -#include -#include +#include +#include +#include char *progname = 0; int verbosity = 0; void -pupa_util_info (const char *fmt, ...) +grub_util_info (const char *fmt, ...) { if (verbosity > 0) { @@ -49,7 +49,7 @@ pupa_util_info (const char *fmt, ...) } void -pupa_util_error (const char *fmt, ...) +grub_util_error (const char *fmt, ...) { va_list ap; @@ -68,7 +68,7 @@ xmalloc (size_t size) p = malloc (size); if (! p) - pupa_util_error ("out of memory"); + grub_util_error ("out of memory"); return p; } @@ -78,7 +78,7 @@ xrealloc (void *ptr, size_t size) { ptr = realloc (ptr, size); if (! ptr) - pupa_util_error ("out of memory"); + grub_util_error ("out of memory"); return ptr; } @@ -97,7 +97,7 @@ xstrdup (const char *str) } char * -pupa_util_get_path (const char *dir, const char *file) +grub_util_get_path (const char *dir, const char *file) { char *path; @@ -107,36 +107,36 @@ pupa_util_get_path (const char *dir, const char *file) } size_t -pupa_util_get_image_size (const char *path) +grub_util_get_image_size (const char *path) { struct stat st; - pupa_util_info ("getting the size of %s", path); + grub_util_info ("getting the size of %s", path); if (stat (path, &st) == -1) - pupa_util_error ("cannot stat %s", path); + grub_util_error ("cannot stat %s", path); return st.st_size; } char * -pupa_util_read_image (const char *path) +grub_util_read_image (const char *path) { char *img; FILE *fp; size_t size; - pupa_util_info ("reading %s", path); + grub_util_info ("reading %s", path); - size = pupa_util_get_image_size (path); + size = grub_util_get_image_size (path); img = (char *) xmalloc (size); fp = fopen (path, "rb"); if (! fp) - pupa_util_error ("cannot open %s", path); + grub_util_error ("cannot open %s", path); if (fread (img, 1, size, fp) != size) - pupa_util_error ("cannot read %s", path); + grub_util_error ("cannot read %s", path); fclose (fp); @@ -144,83 +144,83 @@ pupa_util_read_image (const char *path) } void -pupa_util_load_image (const char *path, char *buf) +grub_util_load_image (const char *path, char *buf) { FILE *fp; size_t size; - pupa_util_info ("reading %s", path); + grub_util_info ("reading %s", path); - size = pupa_util_get_image_size (path); + size = grub_util_get_image_size (path); fp = fopen (path, "rb"); if (! fp) - pupa_util_error ("cannot open %s", path); + grub_util_error ("cannot open %s", path); if (fread (buf, 1, size, fp) != size) - pupa_util_error ("cannot read %s", path); + grub_util_error ("cannot read %s", path); fclose (fp); } void -pupa_util_write_image (const char *img, size_t size, FILE *out) +grub_util_write_image (const char *img, size_t size, FILE *out) { - pupa_util_info ("writing 0x%x bytes", size); + grub_util_info ("writing 0x%x bytes", size); if (fwrite (img, 1, size, out) != size) - pupa_util_error ("write failed"); + grub_util_error ("write failed"); } void * -pupa_malloc (unsigned size) +grub_malloc (unsigned size) { return xmalloc (size); } void -pupa_free (void *ptr) +grub_free (void *ptr) { free (ptr); } void * -pupa_realloc (void *ptr, unsigned size) +grub_realloc (void *ptr, unsigned size) { return xrealloc (ptr, size); } void * -pupa_memalign (pupa_size_t align, pupa_size_t size) +grub_memalign (grub_size_t align, grub_size_t size) { void *p; p = memalign (align, size); if (! p) - pupa_util_error ("out of memory"); + grub_util_error ("out of memory"); return p; } /* Some functions that we don't use. */ void -pupa_mm_init_region (void *addr __attribute__ ((unused)), - pupa_size_t size __attribute__ ((unused))) +grub_mm_init_region (void *addr __attribute__ ((unused)), + grub_size_t size __attribute__ ((unused))) { } void -pupa_register_exported_symbols (void) +grub_register_exported_symbols (void) { } void -pupa_stop (void) +grub_stop (void) { exit (1); } -pupa_uint32_t -pupa_get_rtc (void) +grub_uint32_t +grub_get_rtc (void) { struct tms currtime; diff --git a/util/resolve.c b/util/resolve.c index 7e079ed2c..e144cdf73 100644 --- a/util/resolve.c +++ b/util/resolve.c @@ -1,8 +1,8 @@ /* - * PUPA -- Preliminary Universal Programming Architecture for GRUB + * GRUB -- GRand Unified Bootloader * Copyright (C) 2002 Free Software Foundation, Inc. * - * PUPA is free software; you can redistribute it and/or modify + * 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 2 of the License, or * (at your option) any later version. @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with PUPA; if not, write to the Free Software + * along with GRUB; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ @@ -22,8 +22,8 @@ #include #include -#include -#include +#include +#include /* Module. */ struct mod_list @@ -85,7 +85,7 @@ read_dep_list (FILE *fp) /* Get the target name. */ p = strchr (buf, ':'); if (! p) - pupa_util_error ("invalid line format: %s", buf); + grub_util_error ("invalid line format: %s", buf); *p++ = '\0'; @@ -174,7 +174,7 @@ get_module_path (const char *prefix, const char *str) if (dir) return base; - ret = pupa_util_get_path (prefix, base); + ret = grub_util_get_path (prefix, base); free (base); return ret; } @@ -183,11 +183,11 @@ static void add_module (const char *dir, struct dep_list *dep_list, struct mod_list **mod_head, - struct pupa_util_path_list **path_head, + struct grub_util_path_list **path_head, const char *name) { char *mod_name; - struct pupa_util_path_list *path; + struct grub_util_path_list *path; struct mod_list *mod; struct dep_list *dep; @@ -218,14 +218,14 @@ add_module (const char *dir, *mod_head = mod; /* Add this path. */ - path = (struct pupa_util_path_list *) xmalloc (sizeof (*path)); + path = (struct grub_util_path_list *) xmalloc (sizeof (*path)); path->name = get_module_path (dir, name); path->next = *path_head; *path_head = path; } -struct pupa_util_path_list * -pupa_util_resolve_dependencies (const char *prefix, +struct grub_util_path_list * +grub_util_resolve_dependencies (const char *prefix, const char *dep_list_file, char *modules[]) { @@ -233,12 +233,12 @@ pupa_util_resolve_dependencies (const char *prefix, FILE *fp; struct dep_list *dep_list; struct mod_list *mod_list = 0; - struct pupa_util_path_list *path_list = 0; + struct grub_util_path_list *path_list = 0; - path = pupa_util_get_path (prefix, dep_list_file); + path = grub_util_get_path (prefix, dep_list_file); fp = fopen (path, "r"); if (! fp) - pupa_util_error ("cannot open %s", path); + grub_util_error ("cannot open %s", path); free (path); dep_list = read_dep_list (fp); @@ -254,7 +254,7 @@ pupa_util_resolve_dependencies (const char *prefix, free_mod_list (mod_list); { /* Reverse the path_list */ - struct pupa_util_path_list *p, *prev, *next; + struct grub_util_path_list *p, *prev, *next; for (p = path_list, prev = NULL; p; p = next) {