merge mainline into sparc-mkimage

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-03-03 11:24:36 +01:00
commit 14532662ee
46 changed files with 670 additions and 364 deletions

187
ChangeLog
View file

@ -1,3 +1,190 @@
2010-03-01 Vladimir Serbinenko <phcoder@gmail.com>
* fs/ext2.c (grub_ext2_read_block): Fix an integer overflow.
2010-03-01 Vladimir Serbinenko <phcoder@gmail.com>
Wait for user entry basing on presence of output rather than on errors.
* include/grub/normal.h (grub_normal_get_line_counter): New proto.
(grub_install_newline_hook): Likewise.
* normal/main.c (GRUB_MOD_INIT): Call grub_install_newline_hook.
* normal/menu.c (show_menu): Check line_counter to determine presence
of output.
* normal/term.c (grub_normal_line_counter): New variable.
(grub_normal_get_line_counter): New function.
(grub_install_newline_hook): Likewise.
2010-03-01 Vladimir Serbinenko <phcoder@gmail.com>
* commands/cat.c (grub_cmd_cat): Propagate grub_gzfile_open error.
2010-03-01 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Update version to 1.98.
2010-02-26 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub.d/10_linux.in (linux_entry): Don't default to
gfxpayload=keep if Linux doesn't support video handover.
2010-02-25 Vladimir Serbinenko <phcoder@gmail.com>
Don't compile video modules on yeeloong since video subsystem is part
of kernel.
* conf/common.rmk (pkglib_MODULES) [yeeloong]: Remove video.mod,
video_fb.mod, bitmap.mod, font.mod, gfxterm.mod and bufio.mod
* conf/mips-yeeloong.rmk (kernel_img_HEADERS): Add bitmap.h,
video.h, gfxterm.h, font.h, bitmap_scale.h and bufio.h.
* conf/mips.rmk (kernel_img_HEADERS): Add values instead of overwriting.
* include/grub/bitmap.h: Add EXPORT_FUNC and EXPORT_VAR.
* include/grub/bitmap_scale.h: Likewise.
* include/grub/bufio.h: Likewise.
* include/grub/font.h: Likewise.
* include/grub/gfxterm.h: Likewise.
* include/grub/video.h: Likewise.
* include/grub/vbe.h: Don't include video_fb.h.
* video/i386/pc/vbe.c: Include video_fb.h.
* commands/i386/pc/vbetest.c: Include video.h.
2010-02-25 Jordan Uggla <jordan.uggla@gmail.com>
* util/grub-mkconfig.in (GRUB_SAVEDEFAULT): Export new variable.
* util/grub-mkconfig_lib.in (save_default_entry): Only save a new
default entry if GRUB_SAVEDEFAULT=true. This allows using
GRUB_DEFAULT=saved on its own to let grub-reboot work, without
saving a new default on every boot.
2010-02-24 Vladimir Serbinenko <phcoder@gmail.com>
* normal/crypto.c (read_crypto_list): Fix a memory leak.
* normal/term.c (read_terminal_list): Likewise.
* normal/main.c (grub_normal_init_page): Likewise.
(grub_normal_read_line_real): Likewise.
2010-02-24 Vladimir Serbinenko <phcoder@gmail.com>
* loader/i386/multiboot_mbi.c (grub_multiboot_set_bootdev): Fix a
memory leak.
Reported by: Seth Goldberg.
2010-02-24 Joey Korkames <joey+lists@kidfixit.com>
* term/ieee1275/ofconsole.c (grub_ofconsole_readkey): Remove
duplicate declaration of `start'.
2010-02-20 Vladimir Serbinenko <phcoder@gmail.com>
* fs/iso9660.c (grub_iso9660_iterate_dir): Strip version from joliet
filename.
Reported by: Georgy Buranov
2010-02-20 Carles Pina i Estany <carles@pina.cat>
* util/grub-mkrawimage.c (usage): Change string formatting to
improve gettext.
2010-02-20 Manoel Rebelo Abranches <mrabran@br.ibm.com>
* term/ieee1275/ofconsole.c (grub_ofconsole_readkey): Add delete and
backspace keys.
2010-02-20 Vladimir Serbinenko <phcoder@gmail.com>
* video/fb/video_fb.c (grub_video_fb_scroll): Fix a pixel size bug.
Reported by: Michael Suchanek.
2010-02-18 Samuel Thibault <samuel.thibault@ens-lyon.org>
* util/grub-mkconfig.in: Export GRUB_INIT_TUNE.
* util/grub.d/00_header.in: Handle GRUB_INIT_TUNE.
2010-02-16 Vladimir Serbinenko <phcoder@gmail.com>
Remove any reference to non-free fonts.
* commands/videotest.c (grub_cmd_videotest): Use unifont by default.
* docs/gfxmenu-theme-example.txt: Removed. It's both outdated and
uses non-free components.
* font/font.c (grub_font_get_name): Remove example name.
* gfxmenu/gui_label.c (grub_gui_label_new): Use unifont by default.
* gfxmenu/gui_list.c (grub_gui_list_new): Likewise.
* gfxmenu/gui_progress_bar.c (grub_gui_progress_bar_new): Likewise.
* gfxmenu/view.c (grub_gfxmenu_view_new): Likewise.
2010-02-16 Georgy Buranov <gburanov@gmail.com>
* disk/efi/efidisk.c (grub_efidisk_get_device_name): Fix a typo.
2010-02-15 Vladimir Serbinenko <phcoder@gmail.com>
* term/serial.c (serial_get_divisor) [GRUB_MACHINE_MIPS_YEELOONG]:
Double divisor.
(serial_hw_init) [GRUB_MACHINE_MIPS_YEELOONG]: Don't enable advanced
features.
(GRUB_MOD_INIT) [GRUB_MACHINE_MIPS_YEELOONG]: Default to 115200.
2010-02-15 Vladimir Serbinenko <phcoder@gmail.com>
* gensymlist.sh.in: Use TARGET_CC instead of CC.
2010-02-14 Samuel Thibault <samuel.thibault@ens-lyon.org>
* commands/i386/pc/play.c (GRUB_MOD_INIT(play)): Fix help.
* docs/grub.texi (Command-line and menu entry commands): Document play
command.
2010-02-14 Samuel Thibault <samuel.thibault@ens-lyon.org>
* commands/i386/pc/play.c (grub_cmd_play): If grub_file_open fails,
parse arguments as inline tempo and notes. Move code for playing notes
to...
(play): ... new function.
2010-02-14 Samuel Thibault <samuel.thibault@ens-lyon.org>
* commands/i386/pc/play.c (T_REST, T_FINE, struct note, beep_on): Use
grub_uint16_t instead of short.
(grub_cmd_play): Use grub_uint32_t instead of int, convert data from
disk from little endian to cpu endianness.
2010-02-07 Samuel Thibault <samuel.thibault@ens-lyon.org>
* commands/i386/pc/play.c (BASE_TEMPO): Set to 60 *
GRUB_TICKS_PER_SECOND instead of 120.
2010-02-14 Vladimir Serbinenko <phcoder@gmail.com>
* term/ieee1275/ofconsole.c (grub_ofconsole_readkey): Wait for possible
escape sequence after \e.
2010-02-14 Vladimir Serbinenko <phcoder@gmail.com>
* term/ieee1275/ofconsole.c (grub_ofconsole_putchar): Don't output
non-ASCII characters.
2010-02-14 Vladimir Serbinenko <phcoder@gmail.com>
* util/grub-mkconfig_lib.in (prepare_grub_to_access_device): Enclose
set root in single quotes to prevent \, from being unescaped.
2010-02-14 Vladimir Serbinenko <phcoder@gmail.com>
Prevent unknown commands from stopping menuentry execution.
* script/execute.c (grub_script_execute_cmdline): Print error after
unknown command.
2010-02-14 Vladimir Serbinenko <phcoder@gmail.com>
* fs/i386/pc/pxe.c (GRUB_MOD_INIT): Fix typo.
Reported by: Pavel Pisa.
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
* io/gzio.c (grub_gzio_open): Use grub_zalloc.
2010-02-13 Vladimir Serbinenko <phcoder@gmail.com> 2010-02-13 Vladimir Serbinenko <phcoder@gmail.com>
Merge grub_ieee1275_map_physical into grub_map and rename to Merge grub_ieee1275_map_physical into grub_map and rename to

View file

@ -41,7 +41,7 @@ grub_cmd_cat (grub_command_t cmd __attribute__ ((unused)),
file = grub_gzfile_open (args[0], 1); file = grub_gzfile_open (args[0], 1);
if (! file) if (! file)
return 0; return grub_errno;
while ((size = grub_file_read (file, buf, sizeof (buf))) > 0 while ((size = grub_file_read (file, buf, sizeof (buf))) > 0
&& key != GRUB_TERM_ESC) && key != GRUB_TERM_ESC)

View file

@ -29,7 +29,7 @@
#include <grub/command.h> #include <grub/command.h>
#include <grub/i18n.h> #include <grub/i18n.h>
#define BASE_TEMPO 120 #define BASE_TEMPO (60 * GRUB_TICKS_PER_SECOND)
/* The speaker port. */ /* The speaker port. */
#define SPEAKER 0x61 #define SPEAKER 0x61
@ -101,13 +101,13 @@
#define PIT_CTRL_COUNT_BINARY 0x00 /* 16-bit binary counter. */ #define PIT_CTRL_COUNT_BINARY 0x00 /* 16-bit binary counter. */
#define PIT_CTRL_COUNT_BCD 0x01 /* 4-decade BCD counter. */ #define PIT_CTRL_COUNT_BCD 0x01 /* 4-decade BCD counter. */
#define T_REST ((short) 0) #define T_REST ((grub_uint16_t) 0)
#define T_FINE ((short) -1) #define T_FINE ((grub_uint16_t) -1)
struct note struct note
{ {
short pitch; grub_uint16_t pitch;
short duration; grub_uint16_t duration;
}; };
static void static void
@ -120,7 +120,7 @@ beep_off (void)
} }
static void static void
beep_on (short pitch) beep_on (grub_uint16_t pitch)
{ {
unsigned char status; unsigned char status;
unsigned int counter; unsigned int counter;
@ -143,60 +143,111 @@ beep_on (short pitch)
grub_outb (status | SPEAKER_TMR2 | SPEAKER_DATA, SPEAKER); grub_outb (status | SPEAKER_TMR2 | SPEAKER_DATA, SPEAKER);
} }
static grub_err_t /* Returns whether playing should continue. */
grub_cmd_play (grub_command_t cmd __attribute__ ((unused)), static int
int argc, char **args) play (unsigned tempo, struct note *note)
{ {
grub_file_t file;
struct note buf;
int tempo;
unsigned int to; unsigned int to;
if (argc != 1) if (note->pitch == T_FINE || grub_checkkey () >= 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required"); return 1;
file = grub_file_open (args[0]); grub_dprintf ("play", "pitch = %d, duration = %d\n", note->pitch,
if (! file) note->duration);
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
if (grub_file_read (file, &tempo, sizeof(tempo)) != sizeof(tempo)) switch (note->pitch)
{
grub_file_close (file);
return grub_error (GRUB_ERR_FILE_READ_ERROR,
"file doesn't even contains a full tempo record");
}
grub_dprintf ("play","tempo = %d\n", tempo);
while (grub_file_read (file, &buf,
sizeof (struct note)) == sizeof (struct note)
&& buf.pitch != T_FINE && grub_checkkey () < 0)
{
grub_dprintf ("play", "pitch = %d, duration = %d\n", buf.pitch,
buf.duration);
switch (buf.pitch)
{ {
case T_REST: case T_REST:
beep_off (); beep_off ();
break; break;
default: default:
beep_on (buf.pitch); beep_on (note->pitch);
break; break;
} }
to = grub_get_rtc () + BASE_TEMPO * buf.duration / tempo; to = grub_get_rtc () + BASE_TEMPO * note->duration / tempo;
while (((unsigned int) grub_get_rtc () <= to) && (grub_checkkey () < 0)) while (((unsigned int) grub_get_rtc () <= to) && (grub_checkkey () < 0))
; ;
return 0;
}
static grub_err_t
grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args)
{
grub_file_t file;
if (argc < 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name or tempo and notes required");
file = grub_file_open (args[0]);
if (file)
{
struct note buf;
grub_uint32_t tempo;
if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo))
{
grub_file_close (file);
return grub_error (GRUB_ERR_FILE_READ_ERROR,
"file doesn't even contains a full tempo record");
}
tempo = grub_le_to_cpu32 (tempo);
grub_dprintf ("play","tempo = %d\n", tempo);
while (grub_file_read (file, &buf,
sizeof (struct note)) == sizeof (struct note))
{
buf.pitch = grub_le_to_cpu16 (buf.pitch);
buf.duration = grub_le_to_cpu16 (buf.duration);
if (play (tempo, &buf))
break;
}
grub_file_close (file);
}
else
{
char *end;
unsigned tempo;
struct note note;
int i;
tempo = grub_strtoul (args[0], &end, 0);
if (*end)
/* Was not a number either, assume it was supposed to be a file name. */
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
grub_dprintf ("play","tempo = %d\n", tempo);
for (i = 1; i + 1 < argc; i += 2)
{
note.pitch = grub_strtoul (args[i], &end, 0);
if (*end)
{
grub_error (GRUB_ERR_BAD_NUMBER, "bogus pitch number");
break;
}
note.duration = grub_strtoul (args[i + 1], &end, 0);
if (*end)
{
grub_error (GRUB_ERR_BAD_NUMBER, "bogus duration number");
break;
}
if (play (tempo, &note))
break;
}
} }
beep_off (); beep_off ();
grub_file_close (file);
while (grub_checkkey () > 0) while (grub_checkkey () > 0)
grub_getkey (); grub_getkey ();
@ -208,7 +259,8 @@ static grub_command_t cmd;
GRUB_MOD_INIT(play) GRUB_MOD_INIT(play)
{ {
cmd = grub_register_command ("play", grub_cmd_play, cmd = grub_register_command ("play", grub_cmd_play,
N_("FILE"), N_("Play a tune.")); N_("FILE | TEMPO [PITCH1 DURATION1] [PITCH2 DURATION2] ... "),
N_("Play a tune."));
} }
GRUB_MOD_FINI(play) GRUB_MOD_FINI(play)

View file

@ -24,6 +24,7 @@
#include <grub/term.h> #include <grub/term.h>
#include <grub/machine/init.h> #include <grub/machine/init.h>
#include <grub/machine/vbe.h> #include <grub/machine/vbe.h>
#include <grub/video.h>
#include <grub/err.h> #include <grub/err.h>
#include <grub/i18n.h> #include <grub/i18n.h>

View file

@ -69,9 +69,9 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
color = grub_video_map_rgb (0, 255, 255); color = grub_video_map_rgb (0, 255, 255);
grub_video_fill_rect (color, 100, 100, 100, 100); grub_video_fill_rect (color, 100, 100, 100, 100);
sansbig = grub_font_get ("Helvetica Bold 24"); sansbig = grub_font_get ("Unknown Regular 16");
sans = grub_font_get ("Helvetica Bold 14"); sans = grub_font_get ("Unknown Regular 16");
sanssmall = grub_font_get ("Helvetica 8"); sanssmall = grub_font_get ("Unknown Regular 16");
fixed = grub_font_get ("Fixed 20"); fixed = grub_font_get ("Fixed 20");
if (! sansbig || ! sans || ! sanssmall || ! fixed) if (! sansbig || ! sans || ! sanssmall || ! fixed)
return grub_error (GRUB_ERR_BAD_FONT, "no font loaded"); return grub_error (GRUB_ERR_BAD_FONT, "no font loaded");
@ -126,11 +126,6 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
grub_font_draw_string (str, fixed, color, 16, texty); grub_font_draw_string (str, fixed, color, 16, texty);
texty += grub_font_get_descent (fixed) + grub_font_get_leading (fixed); texty += grub_font_get_descent (fixed) + grub_font_get_leading (fixed);
/* Some character don't exist in the Helvetica font, so the font engine
will fall back to using glyphs from another font that does contain them.
TODO The font engine should be smart about selecting a replacement font
and prioritize fonts with similar sizes. */
texty += grub_font_get_ascent(sansbig); texty += grub_font_get_ascent(sansbig);
grub_font_draw_string (str, sansbig, color, 16, texty); grub_font_draw_string (str, sansbig, color, 16, texty);
texty += grub_font_get_descent (sansbig) + grub_font_get_leading (sansbig); texty += grub_font_get_descent (sansbig) + grub_font_get_leading (sansbig);

View file

@ -621,26 +621,28 @@ sh_mod_SOURCES = script/main.c script/script.c script/execute.c \
sh_mod_CFLAGS = $(COMMON_CFLAGS) sh_mod_CFLAGS = $(COMMON_CFLAGS)
sh_mod_LDFLAGS = $(COMMON_LDFLAGS) sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
ifneq (, $(FONT_SOURCE))
font/font.c_DEPENDENCIES = ascii.h
endif
# Common Video Subsystem specific modules. # Common Video Subsystem specific modules.
pkglib_MODULES += video.mod videotest.mod bitmap.mod tga.mod jpeg.mod \ # On Yeeloong it's part of kernel
png.mod gfxterm.mod video_fb.mod ifneq ($(platform), yeeloong)
# For video.mod. # For video.mod.
pkglib_MODULES += video.mod
video_mod_SOURCES = video/video.c video_mod_SOURCES = video/video.c
video_mod_CFLAGS = $(COMMON_CFLAGS) video_mod_CFLAGS = $(COMMON_CFLAGS)
video_mod_LDFLAGS = $(COMMON_LDFLAGS) video_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += video_fb.mod
video_fb_mod_SOURCES = video/fb/video_fb.c video/fb/fbblit.c \ video_fb_mod_SOURCES = video/fb/video_fb.c video/fb/fbblit.c \
video/fb/fbfill.c video/fb/fbutil.c video/fb/fbfill.c video/fb/fbutil.c
video_fb_mod_CFLAGS = $(COMMON_CFLAGS) video_fb_mod_CFLAGS = $(COMMON_CFLAGS)
video_fb_mod_LDFLAGS = $(COMMON_LDFLAGS) video_fb_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For videotest.mod.
videotest_mod_SOURCES = commands/videotest.c
videotest_mod_CFLAGS = $(COMMON_CFLAGS)
videotest_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For bitmap.mod # For bitmap.mod
pkglib_MODULES += bitmap.mod
bitmap_mod_SOURCES = video/bitmap.c bitmap_mod_SOURCES = video/bitmap.c
bitmap_mod_CFLAGS = $(COMMON_CFLAGS) bitmap_mod_CFLAGS = $(COMMON_CFLAGS)
bitmap_mod_LDFLAGS = $(COMMON_LDFLAGS) bitmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
@ -651,36 +653,46 @@ bitmap_scale_mod_SOURCES = video/bitmap_scale.c
bitmap_scale_mod_CFLAGS = $(COMMON_CFLAGS) bitmap_scale_mod_CFLAGS = $(COMMON_CFLAGS)
bitmap_scale_mod_LDFLAGS = $(COMMON_LDFLAGS) bitmap_scale_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For tga.mod
tga_mod_SOURCES = video/readers/tga.c
tga_mod_CFLAGS = $(COMMON_CFLAGS)
tga_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For jpeg.mod.
jpeg_mod_SOURCES = video/readers/jpeg.c
jpeg_mod_CFLAGS = $(COMMON_CFLAGS)
jpeg_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For png.mod.
png_mod_SOURCES = video/readers/png.c
png_mod_CFLAGS = $(COMMON_CFLAGS)
png_mod_LDFLAGS = $(COMMON_LDFLAGS)
pkglib_MODULES += font.mod pkglib_MODULES += font.mod
ifneq (, $(FONT_SOURCE))
font/font.c_DEPENDENCIES = ascii.h
endif
font_mod_SOURCES = font/font_cmd.c font/font.c font_mod_SOURCES = font/font_cmd.c font/font.c
font_mod_CFLAGS = $(COMMON_CFLAGS) font_mod_CFLAGS = $(COMMON_CFLAGS)
font_mod_LDFLAGS = $(COMMON_LDFLAGS) font_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For gfxterm.mod. # For gfxterm.mod.
pkglib_MODULES += gfxterm.mod
gfxterm_mod_SOURCES = term/gfxterm.c gfxterm_mod_SOURCES = term/gfxterm.c
gfxterm_mod_CFLAGS = $(COMMON_CFLAGS) gfxterm_mod_CFLAGS = $(COMMON_CFLAGS)
gfxterm_mod_LDFLAGS = $(COMMON_LDFLAGS) gfxterm_mod_LDFLAGS = $(COMMON_LDFLAGS)
endif
# For videotest.mod.
pkglib_MODULES += videotest.mod
videotest_mod_SOURCES = commands/videotest.c
videotest_mod_CFLAGS = $(COMMON_CFLAGS)
videotest_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For tga.mod
pkglib_MODULES += tga.mod
tga_mod_SOURCES = video/readers/tga.c
tga_mod_CFLAGS = $(COMMON_CFLAGS)
tga_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For jpeg.mod.
pkglib_MODULES += jpeg.mod
jpeg_mod_SOURCES = video/readers/jpeg.c
jpeg_mod_CFLAGS = $(COMMON_CFLAGS)
jpeg_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For png.mod.
pkglib_MODULES += png.mod
png_mod_SOURCES = video/readers/png.c
png_mod_CFLAGS = $(COMMON_CFLAGS)
png_mod_LDFLAGS = $(COMMON_LDFLAGS)
# Misc. # Misc.
pkglib_MODULES += gzio.mod bufio.mod elf.mod pkglib_MODULES += gzio.mod elf.mod
# For elf.mod. # For elf.mod.
elf_mod_SOURCES = kern/elf.c elf_mod_SOURCES = kern/elf.c
@ -692,10 +704,14 @@ gzio_mod_SOURCES = io/gzio.c
gzio_mod_CFLAGS = $(COMMON_CFLAGS) gzio_mod_CFLAGS = $(COMMON_CFLAGS)
gzio_mod_LDFLAGS = $(COMMON_LDFLAGS) gzio_mod_LDFLAGS = $(COMMON_LDFLAGS)
# On Yeeloong it's part of kernel
ifneq ($(platform), yeeloong)
# For bufio.mod. # For bufio.mod.
pkglib_MODULES += bufio.mod
bufio_mod_SOURCES = io/bufio.c bufio_mod_SOURCES = io/bufio.c
bufio_mod_CFLAGS = $(COMMON_CFLAGS) bufio_mod_CFLAGS = $(COMMON_CFLAGS)
bufio_mod_LDFLAGS = $(COMMON_LDFLAGS) bufio_mod_LDFLAGS = $(COMMON_LDFLAGS)
endif
# For gettext.mod. # For gettext.mod.
pkglib_MODULES += gettext.mod pkglib_MODULES += gettext.mod

View file

@ -3,6 +3,9 @@ LINK_BASE = 0x80200000
target_machine=yeeloong target_machine=yeeloong
COMMON_CFLAGS += -march=mips3 COMMON_CFLAGS += -march=mips3
COMMON_ASFLAGS += -march=mips3 COMMON_ASFLAGS += -march=mips3
kernel_img_HEADERS += bitmap.h video.h gfxterm.h font.h bitmap_scale.h bufio.h
include $(srcdir)/conf/mips.mk include $(srcdir)/conf/mips.mk
pkglib_IMAGES = kernel.img pkglib_IMAGES = kernel.img

View file

@ -13,7 +13,7 @@ script/lexer.c_DEPENDENCIES = grub_script.tab.h
MOSTLYCLEANFILES += symlist.c kernel_syms.lst MOSTLYCLEANFILES += symlist.c kernel_syms.lst
DEFSYMFILES += kernel_syms.lst DEFSYMFILES += kernel_syms.lst
kernel_img_HEADERS = boot.h cache.h device.h disk.h dl.h elf.h elfload.h \ kernel_img_HEADERS += boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
env.h err.h file.h fs.h kernel.h misc.h mm.h net.h parser.h reader.h \ env.h err.h file.h fs.h kernel.h misc.h mm.h net.h parser.h reader.h \
symbol.h term.h time.h types.h loader.h partition.h \ symbol.h term.h time.h types.h loader.h partition.h \
msdos_partition.h machine/kernel.h handler.h list.h \ msdos_partition.h machine/kernel.h handler.h list.h \

View file

@ -31,7 +31,7 @@ dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
dnl type. dnl type.
AC_INIT([GRUB],[1.97],[bug-grub@gnu.org]) AC_INIT([GRUB],[1.98],[bug-grub@gnu.org])
AM_INIT_AUTOMAKE() AM_INIT_AUTOMAKE()
AC_PREREQ(2.60) AC_PREREQ(2.60)
AC_CONFIG_SRCDIR([include/grub/dl.h]) AC_CONFIG_SRCDIR([include/grub/dl.h])

View file

@ -825,7 +825,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
if (! disk) if (! disk)
return 1; return 1;
if (disk->id == GRUB_DISK_DEVICE_EFIDISK_ID) if (disk->dev->id == GRUB_DISK_DEVICE_EFIDISK_ID)
{ {
struct grub_efidisk_data *d; struct grub_efidisk_data *d;

View file

@ -1,128 +0,0 @@
# GRUB gfxmenu theme "winter".
# Uses background image from:
# http://www.cyberpunkcafe.com/e107_plugins/autogallery/autogallery.php?show=1.Open%20Source%20Wallpaper
# "without-leaves.png" was called "Without Leafs in Winter.png"
lua-script: "winter.lua"
title-text: ""
title-font: "Helvetica Bold 18"
status-font: "Helvetica 8"
terminal-font: "Fixed 9"
title-color: "40, 40, 40"
status-color: "#FFF"
status-bg-color: "0, 166, 183, 128"
desktop-image: "without-leaves.png"
desktop-color: "0, 154, 183"
terminal-box: "terminal_*.png"
+ boot_menu {
position = (120, 60)
preferred_size = (400, -1)
item_font = "Helvetica Bold 14"
selected_item_font = "Helvetica Bold 14"
item_color = "0, 0, 0"
selected_item_color = "203, 251, 255"
menu_pixmap_style = "menu_*.png"
selected_item_pixmap_style = "select_*.png"
icon_width = 44
icon_height = 44
item_height = 32
item_padding = 0
item_icon_space = 3
item_spacing = 11
}
# You can add text at arbitrary locations on the screen.
# The specification within the "+label {...}" block is free-form,
# so you can use as much or as little white space as you like.
+ label {
position = (170, 50)
font = "smoothansi 13"
color = "0,0,128"
text = "This is the Winter theme ... brought to you by GRUB!"
}
# Show the text alignment supported by labels.
+ vbox {
position = (220, 347)
preferred_size = (200, -1) # A preferred size of -1 means automatic.
+ label { text="Text alignment demo" align="center" font="aqui 11" }
+ label { text="Left" align="left" font="cure 11" }
+ label { text="Center" align="center" font="cure 11" }
+ label { text="Right" align="right" font="cure 11" }
}
+ vbox {
position = (580, 10)
+ label { text="GNU" font="gelly 11" color="0, 0, 0" }
+ label { text="GRUB" font="aqui 11" color="0, 0, 0" }
+ label { text="boot loader" font="cure 11" color="0, 0, 0" }
}
+ hbox {
position = (80, 10)
+ label { text="GNU" font="gelly 11" color="0, 0, 0" }
+ label { text="GRUB" font="aqui 11" color="0, 0, 0" }
+ label { text="boot loader" font="cure 11" color="0, 0, 0" }
}
# Demonstration of a compound layout: boxes within boxes.
+ hbox
{
position = (480, 3)
+ vbox
{
# Note: We can't just use 'size' to set the image's size,
# since the vbox will resize the component according to its
# preferred size, which for images is the native image size.
+ image { file="/boot/grub/themes/icons/ubuntu.png"
preferred_size = (20, 20) }
+ image { file="/boot/grub/themes/icons/gentoo.png"
preferred_size = (20, 20) }
}
+ vbox
{
+ label { text="GRand" font="cure 11" color=#99F }
+ label { text="Unified" font="cure 11" color=#BBF }
+ label { text="Bootloader" font="cure 11" color=#DDF }
}
}
# By defining a 'progress_bar' type component with an ID of '__timeout__',
# the progress bar will be used to display the time remaining before an
# the default entry is automatically booted.
+ progress_bar
{
id = "__timeout__"
position = (80, 393)
preferred_size = (500, 24)
font = "cure 11"
text_color = #000
fg_color = #CCF
bg_color = #66B
border_color = #006
show_text = false
}
# Although the progress_bar component is normally used to indicate the
# time remaining, it's also possible to create other components with an ID
# of '__timeout__'. All components with and ID of 'timeout_bar' will have
# the following properties set based on the timeout value:
# text, value, start, end, visible.
# In this case, we have set 'show_text=false' on the progress bar, and use
# the following label's 'text' property to display the message.
+ label
{
id = "__timeout__"
position = (80, 420)
preferred_size = (500, 24)
font = "lime 11"
color = #117
align = "center"
}

View file

@ -1126,6 +1126,7 @@ you forget a command, you can run the command @command{help}
* insmod:: Insert a module * insmod:: Insert a module
* keystatus:: Check key modifier status * keystatus:: Check key modifier status
* ls:: List devices or files * ls:: List devices or files
* play:: Play a tune
* reboot:: Reboot your computer * reboot:: Reboot your computer
* set:: Set an environment variable * set:: Set an environment variable
* unset:: Unset an environment variable * unset:: Unset an environment variable
@ -1364,6 +1365,24 @@ name syntax}), then list the contents of that directory.
@end deffn @end deffn
@node play
@subsection play
@deffn Command play file | tempo [pitch1 duration1] [pitch2 duration2] ...
Plays a tune
If the argument is a file name (@pxref{File name syntax}), play the tune
recorded in it. The file format is first the tempo as an unsigned 32bit
little-endian number, then pairs of unsigned 16bit little-endian numbers for
pitch and duration pairs.
If the arguments are a series of numbers, play the inline tune.
The tempo is the base for all note durations. 60 gives a 1-second base, 120
gives a half-second base, etc. Pitches are Hz.
@end deffn
@node reboot @node reboot
@subsection reboot @subsection reboot

View file

@ -862,7 +862,7 @@ grub_font_get (const char *font_name)
return &null_font; return &null_font;
} }
/* Get the full name of the font. For instance, "Helvetica Bold 12". */ /* Get the full name of the font. */
const char * const char *
grub_font_get_name (grub_font_t font) grub_font_get_name (grub_font_t font)
{ {

View file

@ -436,7 +436,8 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
grub_uint32_t indir[blksz / 4]; grub_uint32_t indir[blksz / 4];
if (grub_disk_read (data->disk, if (grub_disk_read (data->disk,
grub_le_to_cpu32 (inode->blocks.indir_block) ((grub_disk_addr_t)
grub_le_to_cpu32 (inode->blocks.indir_block))
<< log2_blksz, << log2_blksz,
0, blksz, indir)) 0, blksz, indir))
return grub_errno; return grub_errno;
@ -452,13 +453,15 @@ grub_ext2_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
grub_uint32_t indir[blksz / 4]; grub_uint32_t indir[blksz / 4];
if (grub_disk_read (data->disk, if (grub_disk_read (data->disk,
grub_le_to_cpu32 (inode->blocks.double_indir_block) ((grub_disk_addr_t)
grub_le_to_cpu32 (inode->blocks.double_indir_block))
<< log2_blksz, << log2_blksz,
0, blksz, indir)) 0, blksz, indir))
return grub_errno; return grub_errno;
if (grub_disk_read (data->disk, if (grub_disk_read (data->disk,
grub_le_to_cpu32 (indir[rblock / perblock]) ((grub_disk_addr_t)
grub_le_to_cpu32 (indir[rblock / perblock]))
<< log2_blksz, << log2_blksz,
0, blksz, indir)) 0, blksz, indir))
return grub_errno; return grub_errno;

View file

@ -568,21 +568,21 @@ GRUB_MOD_INIT(pxe)
buf = grub_xasprintf ("%d", grub_pxe_blksize); buf = grub_xasprintf ("%d", grub_pxe_blksize);
if (buf) if (buf)
grub_env_set ("net_pxe_blksize", buf); grub_env_set ("pxe_blksize", buf);
grub_free (buf); grub_free (buf);
set_ip_env ("pxe_default_server", grub_pxe_default_server_ip); set_ip_env ("pxe_default_server", grub_pxe_default_server_ip);
set_ip_env ("pxe_default_gateway", grub_pxe_default_gateway_ip); set_ip_env ("pxe_default_gateway", grub_pxe_default_gateway_ip);
set_ip_env ("net_pxe_ip", grub_pxe_your_ip); set_ip_env ("net_pxe_ip", grub_pxe_your_ip);
grub_register_variable_hook ("net_pxe_default_server", 0, grub_register_variable_hook ("pxe_default_server", 0,
grub_env_write_pxe_default_server); grub_env_write_pxe_default_server);
grub_register_variable_hook ("net_pxe_default_gateway", 0, grub_register_variable_hook ("pxe_default_gateway", 0,
grub_env_write_pxe_default_gateway); grub_env_write_pxe_default_gateway);
/* XXX: Is it possible to change IP in PXE? */ /* XXX: Is it possible to change IP in PXE? */
grub_register_variable_hook ("net_pxe_ip", 0, grub_register_variable_hook ("net_pxe_ip", 0,
grub_env_write_readonly); grub_env_write_readonly);
grub_register_variable_hook ("net_pxe_blksize", 0, grub_register_variable_hook ("pxe_blksize", 0,
grub_env_write_pxe_blocksize); grub_env_write_pxe_blocksize);
grub_disk_dev_register (&grub_pxe_dev); grub_disk_dev_register (&grub_pxe_dev);
grub_fs_register (&grub_pxefs_fs); grub_fs_register (&grub_pxefs_fs);

View file

@ -629,12 +629,16 @@ grub_iso9660_iterate_dir (grub_fshelp_node_t dir,
if (dir->data->joliet) if (dir->data->joliet)
{ {
char *oldname; char *oldname, *semicolon;
oldname = filename; oldname = filename;
filename = grub_iso9660_convert_string filename = grub_iso9660_convert_string
((grub_uint16_t *) oldname, dirent.namelen >> 1); ((grub_uint16_t *) oldname, dirent.namelen >> 1);
semicolon = grub_strrchr (filename, ';');
if (semicolon)
*semicolon = '\0';
if (filename_alloc) if (filename_alloc)
grub_free (oldname); grub_free (oldname);

View file

@ -14,7 +14,7 @@
### The configure script will replace these variables. ### The configure script will replace these variables.
: ${srcdir=@srcdir@} : ${srcdir=@srcdir@}
: ${CC=@CC@} : ${CC=@TARGET_CC@}
cat <<EOF cat <<EOF

View file

@ -216,7 +216,7 @@ grub_gui_label_new (void)
label->comp.ops = &label_ops; label->comp.ops = &label_ops;
label->visible = 1; label->visible = 1;
label->text = grub_strdup (""); label->text = grub_strdup ("");
label->font = grub_font_get ("Helvetica 10"); label->font = grub_font_get ("Unknown Regular 16");
label->color.red = 0; label->color.red = 0;
label->color.green = 0; label->color.green = 0;
label->color.blue = 0; label->color.blue = 0;

View file

@ -566,7 +566,7 @@ grub_gui_list_new (void)
self->visible = 1; self->visible = 1;
default_font = grub_font_get ("Helvetica 12"); default_font = grub_font_get ("Unknown Regular 16");
default_fg_color = grub_gui_color_rgb (0, 0, 0); default_fg_color = grub_gui_color_rgb (0, 0, 0);
default_bg_color = grub_gui_color_rgb (255, 255, 255); default_bg_color = grub_gui_color_rgb (255, 255, 255);

View file

@ -371,7 +371,7 @@ grub_gui_progress_bar_new (void)
self->progress.ops = &progress_bar_pb_ops; self->progress.ops = &progress_bar_pb_ops;
self->progress.component.ops = &progress_bar_ops; self->progress.component.ops = &progress_bar_ops;
self->visible = 1; self->visible = 1;
self->font = grub_font_get ("Helvetica 10"); self->font = grub_font_get ("Unknown Regular 16");
grub_gui_color_t black = { .red = 0, .green = 0, .blue = 0, .alpha = 255 }; grub_gui_color_t black = { .red = 0, .green = 0, .blue = 0, .alpha = 255 };
grub_gui_color_t gray = { .red = 128, .green = 128, .blue = 128, .alpha = 255 }; grub_gui_color_t gray = { .red = 128, .green = 128, .blue = 128, .alpha = 255 };
grub_gui_color_t lightgray = { .red = 200, .green = 200, .blue = 200, .alpha = 255 }; grub_gui_color_t lightgray = { .red = 200, .green = 200, .blue = 200, .alpha = 255 };

View file

@ -66,7 +66,7 @@ grub_gfxmenu_view_new (const char *theme_path,
view->screen.width = width; view->screen.width = width;
view->screen.height = height; view->screen.height = height;
default_font = grub_font_get ("Helvetica 12"); default_font = grub_font_get ("Unknown Regular 16");
default_fg_color = grub_gui_color_rgb (0, 0, 0); default_fg_color = grub_gui_color_rgb (0, 0, 0);
default_bg_color = grub_gui_color_rgb (255, 255, 255); default_bg_color = grub_gui_color_rgb (255, 255, 255);

View file

@ -47,24 +47,24 @@ struct grub_video_bitmap_reader
}; };
typedef struct grub_video_bitmap_reader *grub_video_bitmap_reader_t; typedef struct grub_video_bitmap_reader *grub_video_bitmap_reader_t;
void grub_video_bitmap_reader_register (grub_video_bitmap_reader_t reader); void EXPORT_FUNC (grub_video_bitmap_reader_register) (grub_video_bitmap_reader_t reader);
void grub_video_bitmap_reader_unregister (grub_video_bitmap_reader_t reader); void EXPORT_FUNC (grub_video_bitmap_reader_unregister) (grub_video_bitmap_reader_t reader);
grub_err_t grub_video_bitmap_create (struct grub_video_bitmap **bitmap, grub_err_t EXPORT_FUNC (grub_video_bitmap_create) (struct grub_video_bitmap **bitmap,
unsigned int width, unsigned int height, unsigned int width, unsigned int height,
enum grub_video_blit_format blit_format); enum grub_video_blit_format blit_format);
grub_err_t grub_video_bitmap_destroy (struct grub_video_bitmap *bitmap); grub_err_t EXPORT_FUNC (grub_video_bitmap_destroy) (struct grub_video_bitmap *bitmap);
grub_err_t grub_video_bitmap_load (struct grub_video_bitmap **bitmap, grub_err_t EXPORT_FUNC (grub_video_bitmap_load) (struct grub_video_bitmap **bitmap,
const char *filename); const char *filename);
unsigned int grub_video_bitmap_get_width (struct grub_video_bitmap *bitmap); unsigned int EXPORT_FUNC (grub_video_bitmap_get_width) (struct grub_video_bitmap *bitmap);
unsigned int grub_video_bitmap_get_height (struct grub_video_bitmap *bitmap); unsigned int EXPORT_FUNC (grub_video_bitmap_get_height) (struct grub_video_bitmap *bitmap);
void grub_video_bitmap_get_mode_info (struct grub_video_bitmap *bitmap, void EXPORT_FUNC (grub_video_bitmap_get_mode_info) (struct grub_video_bitmap *bitmap,
struct grub_video_mode_info *mode_info); struct grub_video_mode_info *mode_info);
void *grub_video_bitmap_get_data (struct grub_video_bitmap *bitmap); void *EXPORT_FUNC (grub_video_bitmap_get_data) (struct grub_video_bitmap *bitmap);
#endif /* ! GRUB_BITMAP_HEADER */ #endif /* ! GRUB_BITMAP_HEADER */

View file

@ -39,10 +39,11 @@ enum grub_video_bitmap_scale_method
}; };
grub_err_t grub_err_t
grub_video_bitmap_create_scaled (struct grub_video_bitmap **dst, EXPORT_FUNC (grub_video_bitmap_create_scaled) (struct grub_video_bitmap **dst,
int dst_width, int dst_height, int dst_width, int dst_height,
struct grub_video_bitmap *src, struct grub_video_bitmap *src,
enum enum
grub_video_bitmap_scale_method scale_method); grub_video_bitmap_scale_method
scale_method);
#endif /* ! GRUB_BITMAP_SCALE_HEADER */ #endif /* ! GRUB_BITMAP_SCALE_HEADER */

View file

@ -22,7 +22,7 @@
#include <grub/file.h> #include <grub/file.h>
grub_file_t grub_bufio_open (grub_file_t io, int size); grub_file_t EXPORT_FUNC (grub_bufio_open) (grub_file_t io, int size);
grub_file_t grub_buffile_open (const char *name, int size); grub_file_t EXPORT_FUNC (grub_buffile_open) (const char *name, int size);
#endif /* ! GRUB_BUFIO_H */ #endif /* ! GRUB_BUFIO_H */

View file

@ -81,35 +81,37 @@ int grub_font_load (const char *filename);
"Family Name Bold Italic 14", where Bold and Italic are optional. "Family Name Bold Italic 14", where Bold and Italic are optional.
If no font matches the name specified, the most recently loaded font If no font matches the name specified, the most recently loaded font
is returned as a fallback. */ is returned as a fallback. */
grub_font_t grub_font_get (const char *font_name); grub_font_t EXPORT_FUNC (grub_font_get) (const char *font_name);
const char *grub_font_get_name (grub_font_t font); const char *EXPORT_FUNC (grub_font_get_name) (grub_font_t font);
int grub_font_get_max_char_width (grub_font_t font); int EXPORT_FUNC (grub_font_get_max_char_width) (grub_font_t font);
int grub_font_get_max_char_height (grub_font_t font); int EXPORT_FUNC (grub_font_get_max_char_height) (grub_font_t font);
int grub_font_get_ascent (grub_font_t font); int EXPORT_FUNC (grub_font_get_ascent) (grub_font_t font);
int grub_font_get_descent (grub_font_t font); int EXPORT_FUNC (grub_font_get_descent) (grub_font_t font);
int grub_font_get_leading (grub_font_t font); int EXPORT_FUNC (grub_font_get_leading) (grub_font_t font);
int grub_font_get_height (grub_font_t font); int EXPORT_FUNC (grub_font_get_height) (grub_font_t font);
int grub_font_get_string_width (grub_font_t font, const char *str); int EXPORT_FUNC (grub_font_get_string_width) (grub_font_t font,
const char *str);
struct grub_font_glyph *grub_font_get_glyph (grub_font_t font, struct grub_font_glyph *EXPORT_FUNC (grub_font_get_glyph) (grub_font_t font,
grub_uint32_t code); grub_uint32_t code);
struct grub_font_glyph *grub_font_get_glyph_with_fallback (grub_font_t font, struct grub_font_glyph *EXPORT_FUNC (grub_font_get_glyph_with_fallback) (grub_font_t font,
grub_uint32_t code); grub_uint32_t code);
grub_err_t grub_font_draw_glyph (struct grub_font_glyph *glyph, grub_err_t EXPORT_FUNC (grub_font_draw_glyph) (struct grub_font_glyph *glyph,
grub_video_color_t color, grub_video_color_t color,
int left_x, int baseline_y); int left_x, int baseline_y);
grub_err_t grub_font_draw_string (const char *str, grub_font_t font, grub_err_t EXPORT_FUNC (grub_font_draw_string) (const char *str,
grub_font_t font,
grub_video_color_t color, grub_video_color_t color,
int left_x, int baseline_y); int left_x, int baseline_y);

View file

@ -25,7 +25,7 @@
#include <grub/video.h> #include <grub/video.h>
grub_err_t grub_err_t
grub_gfxterm_set_window (struct grub_video_render_target *target, EXPORT_FUNC (grub_gfxterm_set_window) (struct grub_video_render_target *target,
int x, int y, int width, int height, int x, int y, int width, int height,
int double_repaint, int double_repaint,
const char *font_name, int border_width); const char *font_name, int border_width);
@ -35,10 +35,10 @@ typedef void (*grub_gfxterm_repaint_callback_t)(int x, int y,
void grub_gfxterm_set_repaint_callback (grub_gfxterm_repaint_callback_t func); void grub_gfxterm_set_repaint_callback (grub_gfxterm_repaint_callback_t func);
void grub_gfxterm_schedule_repaint (void); void EXPORT_FUNC (grub_gfxterm_schedule_repaint) (void);
grub_err_t grub_gfxterm_fullscreen (void); grub_err_t EXPORT_FUNC (grub_gfxterm_fullscreen) (void);
extern void (*grub_gfxterm_decorator_hook) (void); extern void (*EXPORT_VAR (grub_gfxterm_decorator_hook)) (void);
#endif /* ! GRUB_GFXTERM_HEADER */ #endif /* ! GRUB_GFXTERM_HEADER */

View file

@ -19,8 +19,6 @@
#ifndef GRUB_VBE_MACHINE_HEADER #ifndef GRUB_VBE_MACHINE_HEADER
#define GRUB_VBE_MACHINE_HEADER 1 #define GRUB_VBE_MACHINE_HEADER 1
#include <grub/video_fb.h>
/* Default video mode to be used. */ /* Default video mode to be used. */
#define GRUB_VBE_DEFAULT_VIDEO_MODE 0x101 #define GRUB_VBE_DEFAULT_VIDEO_MODE 0x101

View file

@ -110,4 +110,7 @@ void read_terminal_list (void);
void grub_set_more (int onoff); void grub_set_more (int onoff);
int grub_normal_get_line_counter (void);
void grub_install_newline_hook (void);
#endif /* ! GRUB_NORMAL_HEADER */ #endif /* ! GRUB_NORMAL_HEADER */

View file

@ -259,13 +259,13 @@ struct grub_video_adapter
}; };
typedef struct grub_video_adapter *grub_video_adapter_t; typedef struct grub_video_adapter *grub_video_adapter_t;
void grub_video_register (grub_video_adapter_t adapter); void EXPORT_FUNC (grub_video_register) (grub_video_adapter_t adapter);
void grub_video_unregister (grub_video_adapter_t adapter); void grub_video_unregister (grub_video_adapter_t adapter);
void grub_video_iterate (int (*hook) (grub_video_adapter_t adapter)); void grub_video_iterate (int (*hook) (grub_video_adapter_t adapter));
grub_err_t grub_video_restore (void); grub_err_t EXPORT_FUNC (grub_video_restore) (void);
grub_err_t grub_video_get_info (struct grub_video_mode_info *mode_info); grub_err_t EXPORT_FUNC (grub_video_get_info) (struct grub_video_mode_info *mode_info);
/* Framebuffer address may change as a part of normal operation /* Framebuffer address may change as a part of normal operation
(e.g. double buffering). That's why you need to stop video subsystem to be (e.g. double buffering). That's why you need to stop video subsystem to be
@ -283,55 +283,69 @@ grub_err_t grub_video_set_palette (unsigned int start, unsigned int count,
grub_err_t grub_video_get_palette (unsigned int start, unsigned int count, grub_err_t grub_video_get_palette (unsigned int start, unsigned int count,
struct grub_video_palette_data *palette_data); struct grub_video_palette_data *palette_data);
grub_err_t grub_video_set_viewport (unsigned int x, unsigned int y, grub_err_t EXPORT_FUNC (grub_video_set_viewport) (unsigned int x,
unsigned int width, unsigned int height); unsigned int y,
unsigned int width,
unsigned int height);
grub_err_t grub_video_get_viewport (unsigned int *x, unsigned int *y, grub_err_t EXPORT_FUNC (grub_video_get_viewport) (unsigned int *x,
unsigned int *width, unsigned int *height); unsigned int *y,
unsigned int *width,
unsigned int *height);
grub_video_color_t grub_video_map_color (grub_uint32_t color_name); grub_video_color_t EXPORT_FUNC (grub_video_map_color) (grub_uint32_t color_name);
grub_video_color_t grub_video_map_rgb (grub_uint8_t red, grub_uint8_t green, grub_video_color_t EXPORT_FUNC (grub_video_map_rgb) (grub_uint8_t red,
grub_uint8_t green,
grub_uint8_t blue); grub_uint8_t blue);
grub_video_color_t grub_video_map_rgba (grub_uint8_t red, grub_uint8_t green, grub_video_color_t EXPORT_FUNC (grub_video_map_rgba) (grub_uint8_t red,
grub_uint8_t blue, grub_uint8_t alpha); grub_uint8_t green,
grub_uint8_t blue,
grub_uint8_t alpha);
grub_err_t grub_video_unmap_color (grub_video_color_t color, grub_err_t EXPORT_FUNC (grub_video_unmap_color) (grub_video_color_t color,
grub_uint8_t *red, grub_uint8_t *green, grub_uint8_t *red,
grub_uint8_t *blue, grub_uint8_t *alpha); grub_uint8_t *green,
grub_uint8_t *blue,
grub_uint8_t *alpha);
grub_err_t grub_video_fill_rect (grub_video_color_t color, int x, int y, grub_err_t EXPORT_FUNC (grub_video_fill_rect) (grub_video_color_t color,
unsigned int width, unsigned int height); int x, int y,
unsigned int width,
unsigned int height);
grub_err_t grub_video_blit_bitmap (struct grub_video_bitmap *bitmap, grub_err_t EXPORT_FUNC (grub_video_blit_bitmap) (struct grub_video_bitmap *bitmap,
enum grub_video_blit_operators oper,
int x, int y, int offset_x, int offset_y,
unsigned int width, unsigned int height);
grub_err_t grub_video_blit_render_target (struct grub_video_render_target *source,
enum grub_video_blit_operators oper, enum grub_video_blit_operators oper,
int x, int y, int x, int y,
int offset_x, int offset_y, int offset_x, int offset_y,
unsigned int width, unsigned int width,
unsigned int height); unsigned int height);
grub_err_t EXPORT_FUNC (grub_video_blit_render_target) (struct grub_video_render_target *source,
enum grub_video_blit_operators oper,
int x, int y,
int offset_x,
int offset_y,
unsigned int width,
unsigned int height);
grub_err_t grub_video_scroll (grub_video_color_t color, int dx, int dy); grub_err_t grub_video_scroll (grub_video_color_t color, int dx, int dy);
grub_err_t grub_video_swap_buffers (void); grub_err_t EXPORT_FUNC (grub_video_swap_buffers) (void);
grub_err_t grub_video_create_render_target (struct grub_video_render_target **result, grub_err_t EXPORT_FUNC (grub_video_create_render_target) (struct grub_video_render_target **result,
unsigned int width, unsigned int width,
unsigned int height, unsigned int height,
unsigned int mode_type); unsigned int mode_type);
grub_err_t grub_video_delete_render_target (struct grub_video_render_target *target); grub_err_t EXPORT_FUNC (grub_video_delete_render_target) (struct grub_video_render_target *target);
grub_err_t grub_video_set_active_render_target (struct grub_video_render_target *target); grub_err_t EXPORT_FUNC (grub_video_set_active_render_target) (struct grub_video_render_target *target);
grub_err_t grub_video_get_active_render_target (struct grub_video_render_target **target); grub_err_t grub_video_get_active_render_target (struct grub_video_render_target **target);
grub_err_t grub_video_set_mode (const char *modestring, grub_err_t EXPORT_FUNC (grub_video_set_mode) (const char *modestring,
unsigned int modemask, unsigned int modemask,
unsigned int modevalue); unsigned int modevalue);

View file

@ -1121,14 +1121,13 @@ grub_gzio_open (grub_file_t io, int transparent)
if (! file) if (! file)
return 0; return 0;
gzio = grub_malloc (sizeof (*gzio)); gzio = grub_zalloc (sizeof (*gzio));
if (! gzio) if (! gzio)
{ {
grub_free (file); grub_free (file);
return 0; return 0;
} }
grub_memset (gzio, 0, sizeof (*gzio));
gzio->file = io; gzio->file = io;
file->device = io->device; file->device = io->device;

View file

@ -463,6 +463,7 @@ grub_multiboot_set_bootdev (void)
if ((p[0] >= 'a') && (p[0] <= 'z')) if ((p[0] >= 'a') && (p[0] <= 'z'))
part = p[0] - 'a'; part = p[0] - 'a';
} }
grub_free (p);
} }
if (dev) if (dev)
grub_device_close (dev); grub_device_close (dev);

View file

@ -88,6 +88,7 @@ read_crypto_list (void)
} }
file = grub_file_open (filename); file = grub_file_open (filename);
grub_free (filename);
if (!file) if (!file)
{ {
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;

View file

@ -418,6 +418,7 @@ grub_normal_init_page (struct grub_term_output *term)
msg_len = grub_utf8_to_ucs4_alloc (msg_formatted, msg_len = grub_utf8_to_ucs4_alloc (msg_formatted,
&unicode_msg, &last_position); &unicode_msg, &last_position);
grub_free (msg_formatted);
if (msg_len < 0) if (msg_len < 0)
{ {
@ -582,11 +583,14 @@ grub_normal_read_line_real (char **line, int cont, int nested)
if (cont || nested) if (cont || nested)
{ {
grub_free (*line); grub_free (*line);
grub_free (prompt);
*line = 0; *line = 0;
return grub_errno; return grub_errno;
} }
} }
grub_free (prompt);
return 0; return 0;
} }
@ -650,6 +654,7 @@ GRUB_MOD_INIT(normal)
grub_set_history (GRUB_DEFAULT_HISTORY_SIZE); grub_set_history (GRUB_DEFAULT_HISTORY_SIZE);
grub_install_newline_hook ();
grub_register_variable_hook ("pager", 0, grub_env_write_pager); grub_register_variable_hook ("pager", 0, grub_env_write_pager);
/* Register a command "normal" for the rescue mode. */ /* Register a command "normal" for the rescue mode. */

View file

@ -559,16 +559,16 @@ show_menu (grub_menu_t menu, int nested)
} }
else else
{ {
int lines_before = grub_normal_get_line_counter ();
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
grub_menu_execute_entry (e); grub_menu_execute_entry (e);
if (grub_errno != GRUB_ERR_NONE)
{
grub_print_error (); grub_print_error ();
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
if (lines_before != grub_normal_get_line_counter ())
grub_wait_after_message (); grub_wait_after_message ();
} }
} }
}
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
} }

View file

@ -30,6 +30,14 @@ static unsigned grub_more_lines;
/* If the more pager is active. */ /* If the more pager is active. */
static int grub_more; static int grub_more;
static int grub_normal_line_counter = 0;
int
grub_normal_get_line_counter (void)
{
return grub_normal_line_counter;
}
static void static void
process_newline (void) process_newline (void)
{ {
@ -41,6 +49,8 @@ process_newline (void)
height = grub_term_height (cur); height = grub_term_height (cur);
grub_more_lines++; grub_more_lines++;
grub_normal_line_counter++;
if (grub_more && grub_more_lines >= height - 1) if (grub_more && grub_more_lines >= height - 1)
{ {
char key; char key;
@ -76,6 +86,11 @@ grub_set_more (int onoff)
grub_more--; grub_more--;
grub_more_lines = 0; grub_more_lines = 0;
}
void
grub_install_newline_hook (void)
{
grub_newline_hook = process_newline; grub_newline_hook = process_newline;
} }
@ -150,7 +165,6 @@ grub_terminal_autoload_free (void)
grub_term_output_autoload = NULL; grub_term_output_autoload = NULL;
} }
/* Read the file terminal.lst for auto-loading. */ /* Read the file terminal.lst for auto-loading. */
void void
read_terminal_list (void) read_terminal_list (void)
@ -175,6 +189,7 @@ read_terminal_list (void)
} }
file = grub_file_open (filename); file = grub_file_open (filename);
grub_free (filename);
if (!file) if (!file)
{ {
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;

View file

@ -100,8 +100,7 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd)
grubcmd = grub_command_find (cmdname); grubcmd = grub_command_find (cmdname);
if (! grubcmd) if (! grubcmd)
{ {
/* Shouldn't happen but precaution is good. */ grub_errno = GRUB_ERR_NONE;
grub_print_error ();
/* It's not a GRUB command, try all functions. */ /* It's not a GRUB command, try all functions. */
func = grub_script_function_find (cmdname); func = grub_script_function_find (cmdname);
@ -126,6 +125,8 @@ grub_script_execute_cmdline (struct grub_script_cmd *cmd)
grub_snprintf (errnobuf, sizeof (errnobuf), "%d", grub_errno); grub_snprintf (errnobuf, sizeof (errnobuf), "%d", grub_errno);
grub_env_set ("?", errnobuf); grub_env_set ("?", errnobuf);
grub_print_error ();
return 0; return 0;
} }
} }

View file

@ -21,6 +21,7 @@
#include <grub/types.h> #include <grub/types.h>
#include <grub/misc.h> #include <grub/misc.h>
#include <grub/mm.h> #include <grub/mm.h>
#include <grub/time.h>
#include <grub/machine/console.h> #include <grub/machine/console.h>
#include <grub/ieee1275/ieee1275.h> #include <grub/ieee1275/ieee1275.h>
@ -77,7 +78,52 @@ grub_ofconsole_writeesc (const char *str)
static void static void
grub_ofconsole_putchar (grub_uint32_t c) grub_ofconsole_putchar (grub_uint32_t c)
{ {
char chr = c; char chr;
if (c > 0x7F)
{
/* Better than nothing. */
switch (c)
{
case GRUB_TERM_DISP_LEFT:
c = '<';
break;
case GRUB_TERM_DISP_UP:
c = '^';
break;
case GRUB_TERM_DISP_RIGHT:
c = '>';
break;
case GRUB_TERM_DISP_DOWN:
c = 'v';
break;
case GRUB_TERM_DISP_HLINE:
c = '-';
break;
case GRUB_TERM_DISP_VLINE:
c = '|';
break;
case GRUB_TERM_DISP_UL:
case GRUB_TERM_DISP_UR:
case GRUB_TERM_DISP_LL:
case GRUB_TERM_DISP_LR:
c = '+';
break;
default:
c = '?';
break;
}
}
chr = c;
if (c == '\n') if (c == '\n')
{ {
grub_curr_y++; grub_curr_y++;
@ -156,9 +202,23 @@ grub_ofconsole_readkey (int *key)
grub_ieee1275_read (stdin_ihandle, &c, 1, &actual); grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
if (actual > 0 && c == '\e') if (actual > 0)
switch(c)
{ {
case 0x7f:
/* Backspace: Ctrl-h. */
c = '\b';
break;
case '\e':
{
grub_uint64_t start;
grub_ieee1275_read (stdin_ihandle, &c, 1, &actual); grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
/* On 9600 we have to wait up to 12 milliseconds. */
start = grub_get_time_ms ();
while (actual <= 0 && grub_get_time_ms () - start < 12)
grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
if (actual <= 0) if (actual <= 0)
{ {
*key = '\e'; *key = '\e';
@ -169,6 +229,11 @@ grub_ofconsole_readkey (int *key)
return 0; return 0;
grub_ieee1275_read (stdin_ihandle, &c, 1, &actual); grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
/* On 9600 we have to wait up to 12 milliseconds. */
start = grub_get_time_ms ();
while (actual <= 0 && grub_get_time_ms () - start < 12)
grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
if (actual <= 0) if (actual <= 0)
return 0; return 0;
@ -190,6 +255,26 @@ grub_ofconsole_readkey (int *key)
/* Left: Ctrl-b. */ /* Left: Ctrl-b. */
c = GRUB_TERM_LEFT; c = GRUB_TERM_LEFT;
break; break;
case '3':
{
grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
/* On 9600 we have to wait up to 12 milliseconds. */
start = grub_get_time_ms ();
while (actual <= 0 && grub_get_time_ms () - start < 12)
grub_ieee1275_read (stdin_ihandle, &c, 1, &actual);
if (actual <= 0)
return 0;
/* Delete: Ctrl-d. */
if (c == '~')
c = GRUB_TERM_DC;
else
return 0;
break;
}
break;
}
} }
} }

View file

@ -232,7 +232,12 @@ serial_get_divisor (unsigned int speed)
/* Set the baud rate. */ /* Set the baud rate. */
for (i = 0; i < sizeof (divisor_tab) / sizeof (divisor_tab[0]); i++) for (i = 0; i < sizeof (divisor_tab) / sizeof (divisor_tab[0]); i++)
if (divisor_tab[i].speed == speed) if (divisor_tab[i].speed == speed)
/* UART in Yeeloong runs twice the usual rate. */
#ifdef GRUB_MACHINE_MIPS_YEELOONG
return 2 * divisor_tab[i].div;
#else
return divisor_tab[i].div; return divisor_tab[i].div;
#endif
return 0; return 0;
} }
@ -292,11 +297,14 @@ serial_hw_init (void)
| serial_settings.stop_bits); | serial_settings.stop_bits);
grub_outb (status, serial_settings.port + UART_LCR); grub_outb (status, serial_settings.port + UART_LCR);
/* In Yeeloong serial port has only 3 wires. */
#ifndef GRUB_MACHINE_MIPS_YEELOONG
/* Enable the FIFO. */ /* Enable the FIFO. */
grub_outb (UART_ENABLE_FIFO, serial_settings.port + UART_FCR); grub_outb (UART_ENABLE_FIFO, serial_settings.port + UART_FCR);
/* Turn on DTR, RTS, and OUT2. */ /* Turn on DTR, RTS, and OUT2. */
grub_outb (UART_ENABLE_MODEM, serial_settings.port + UART_MCR); grub_outb (UART_ENABLE_MODEM, serial_settings.port + UART_MCR);
#endif
/* Drain the input buffer. */ /* Drain the input buffer. */
while (grub_serial_checkkey () != -1) while (grub_serial_checkkey () != -1)
@ -613,7 +621,11 @@ GRUB_MOD_INIT(serial)
/* Set default settings. */ /* Set default settings. */
serial_settings.port = serial_hw_get_port (0); serial_settings.port = serial_hw_get_port (0);
#ifdef GRUB_MACHINE_MIPS_YEELOONG
serial_settings.divisor = serial_get_divisor (115200);
#else
serial_settings.divisor = serial_get_divisor (9600); serial_settings.divisor = serial_get_divisor (9600);
#endif
serial_settings.word_len = UART_8BITS_WORD; serial_settings.word_len = UART_8BITS_WORD;
serial_settings.parity = UART_NO_PARITY; serial_settings.parity = UART_NO_PARITY;
serial_settings.stop_bits = UART_1_STOP_BIT; serial_settings.stop_bits = UART_1_STOP_BIT;

View file

@ -222,7 +222,9 @@ export GRUB_DEFAULT \
GRUB_GFXMODE \ GRUB_GFXMODE \
GRUB_THEME \ GRUB_THEME \
GRUB_GFXPAYLOAD_LINUX \ GRUB_GFXPAYLOAD_LINUX \
GRUB_DISABLE_OS_PROBER GRUB_DISABLE_OS_PROBER \
GRUB_INIT_TUNE \
GRUB_SAVEDEFAULT
if test "x${grub_cfg}" != "x"; then if test "x${grub_cfg}" != "x"; then
rm -f ${grub_cfg}.new rm -f ${grub_cfg}.new

View file

@ -96,7 +96,7 @@ convert_system_path_to_grub_path ()
save_default_entry () save_default_entry ()
{ {
if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then if [ "x${GRUB_SAVEDEFAULT}" = "xtrue" ] ; then
cat << EOF cat << EOF
savedefault savedefault
EOF EOF
@ -120,7 +120,7 @@ prepare_grub_to_access_device ()
# If there's a filesystem UUID that GRUB is capable of identifying, use it; # If there's a filesystem UUID that GRUB is capable of identifying, use it;
# otherwise set root as per value in device.map. # otherwise set root as per value in device.map.
echo "set root=`${grub_probe} --device ${device} --target=drive`" echo "set root='`${grub_probe} --device ${device} --target=drive`'"
if fs_uuid="`${grub_probe} --device ${device} --target=fs_uuid 2> /dev/null`" ; then if fs_uuid="`${grub_probe} --device ${device} --target=fs_uuid 2> /dev/null`" ; then
echo "search --no-floppy --fs-uuid --set ${fs_uuid}" echo "search --no-floppy --fs-uuid --set ${fs_uuid}"
fi fi

View file

@ -490,10 +490,8 @@ Make a bootable image of GRUB.\n\
-o, --output=FILE output a generated image to FILE [default=stdout]\n" -o, --output=FILE output a generated image to FILE [default=stdout]\n"
#ifdef GRUB_PLATFORM_IMAGE_DEFAULT #ifdef GRUB_PLATFORM_IMAGE_DEFAULT
"\ "\
-O, --format=FORMAT generate an image in format [default=" -O, --format=FORMAT generate an image in format [default=%s]\n\
GRUB_PLATFORM_IMAGE_DEFAULT_FORMAT "]\n \ available formats: %s\n"
available formats: "
GRUB_PLATFORM_IMAGE_FORMATS "\n"
#endif #endif
"\ "\
-h, --help display this message and exit\n\ -h, --help display this message and exit\n\
@ -501,7 +499,12 @@ Make a bootable image of GRUB.\n\
-v, --verbose print verbose messages\n\ -v, --verbose print verbose messages\n\
\n\ \n\
Report bugs to <%s>.\n\ Report bugs to <%s>.\n\
"), program_name, GRUB_LIBDIR, DEFAULT_DIRECTORY, PACKAGE_BUGREPORT); "),
program_name, GRUB_LIBDIR, DEFAULT_DIRECTORY,
#ifdef GRUB_PLATFORM_IMAGE_DEFAULT
GRUB_PLATFORM_IMAGE_DEFAULT_FORMAT, GRUB_PLATFORM_IMAGE_FORMATS,
#endif
PACKAGE_BUGREPORT);
exit (status); exit (status);
} }

View file

@ -158,3 +158,11 @@ else
set timeout=${GRUB_TIMEOUT} set timeout=${GRUB_TIMEOUT}
EOF EOF
fi fi
# Play an initial tune
if [ "x${GRUB_INIT_TUNE}" != "x" ] ; then
cat << EOF
insmod play
play ${GRUB_INIT_TUNE}
EOF
fi

View file

@ -66,7 +66,8 @@ linux_entry ()
# Use ELILO's generic "efifb" when it's known to be available. # Use ELILO's generic "efifb" when it's known to be available.
# FIXME: We need an interface to select vesafb in case efifb can't be used. # FIXME: We need an interface to select vesafb in case efifb can't be used.
if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then
if grep -qx "CONFIG_FB_EFI=y" /boot/config-${version} 2> /dev/null ; then if grep -qx "CONFIG_FB_EFI=y" /boot/config-${version} 2> /dev/null \
&& grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" /boot/config-${version} 2> /dev/null; then
cat << EOF cat << EOF
set gfxpayload=keep set gfxpayload=keep
EOF EOF

View file

@ -1006,11 +1006,13 @@ grub_video_fb_scroll (grub_video_color_t color, int dx, int dy)
{ \ { \
/* 3b. Move data downwards. */ \ /* 3b. Move data downwards. */ \
dst = (void *) grub_video_fb_get_video_ptr (&target, \ dst = (void *) grub_video_fb_get_video_ptr (&target, \
dst_x + width - 1, \ dst_x + width, \
dst_y + height - 1); \ dst_y + height - 1); \
src = (void *) grub_video_fb_get_video_ptr (&target, \ src = (void *) grub_video_fb_get_video_ptr (&target, \
src_x + width - 1, \ src_x + width, \
src_y + height - 1); \ src_y + height - 1); \
dst--; \
src--; \
for (j = 0; j < height; j++) \ for (j = 0; j < height; j++) \
{ \ { \
for (i = 0; i < linelen; i++) \ for (i = 0; i < linelen; i++) \

View file

@ -22,6 +22,7 @@
#include <grub/machine/memory.h> #include <grub/machine/memory.h>
#include <grub/machine/vga.h> #include <grub/machine/vga.h>
#include <grub/machine/vbe.h> #include <grub/machine/vbe.h>
#include <grub/video_fb.h>
#include <grub/types.h> #include <grub/types.h>
#include <grub/dl.h> #include <grub/dl.h>
#include <grub/misc.h> #include <grub/misc.h>