From e3538adaea469c20a2ab77d97891b068bb5b6013 Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Wed, 20 Jan 2010 01:19:53 +0000 Subject: [PATCH] 2009-12-20 Robert Millan * kern/mips/yeeloong/init.c (grub_video_sm712_init) (grub_video_video_init, grub_video_bitmap_init) (grub_font_manager_init, grub_term_gfxterm_init) (grub_at_keyboard_init): New extern declarations. (grub_machine_init): Initialize gfxterm and at_keyboard. * kern/main.c (grub_main): Revert grub_printf delay kludge. * util/grub-install.in: Revert embed of `at_keyboard.mod' and `gfxterm.mod' into core image. * conf/mips.rmk (pkglib_IMAGES, kernel_img_SOURCES) (kernel_img_CFLAGS, kernel_img_ASFLAGS, kernel_img_LDFLAGS) (kernel_img_FORMAT): Copy to ... * conf/mips-qemu-mips.rmk (pkglib_IMAGES, kernel_img_SOURCES) (kernel_img_CFLAGS, kernel_img_ASFLAGS, kernel_img_LDFLAGS) (kernel_img_FORMAT): ... here, and ... * conf/mips-yeeloong.rmk (pkglib_IMAGES, kernel_img_SOURCES) (kernel_img_CFLAGS, kernel_img_ASFLAGS, kernel_img_LDFLAGS) (kernel_img_FORMAT): ... here. (kernel_img_SOURCES): Add files necessary for output (gfxterm) and input (at_keyboard) terminals in kernel. (kernel_img_CFLAGS): Add `-DUSE_ASCII_FAILBACK'. (pkglib_MODULES): Remove `pci.mod'. (pci_mod_SOURCES, pci_mod_CFLAGS, pci_mod_LDFLAGS) (sm712_mod_SOURCES, sm712_mod_CFLAGS, sm712_mod_LDFLAGS) (at_keyboard_mod_SOURCES, at_keyboard_mod_CFLAGS) (at_keyboard_mod_LDFLAGS): Remove variables. --- ChangeLog.mips | 35 +++++++++++++++++++++++++++++++++ conf/mips-qemu-mips.rmk | 17 ++++++++++++++++ conf/mips-yeeloong.rmk | 41 +++++++++++++++++++++++---------------- conf/mips.rmk | 18 ----------------- kern/main.c | 12 ++++++------ kern/mips/yeeloong/init.c | 19 +++++++++++++++++- util/grub-install.in | 4 ---- 7 files changed, 100 insertions(+), 46 deletions(-) diff --git a/ChangeLog.mips b/ChangeLog.mips index 1bbe1c273..12797095d 100644 --- a/ChangeLog.mips +++ b/ChangeLog.mips @@ -1,3 +1,38 @@ +2009-12-20 Robert Millan + + * kern/mips/yeeloong/init.c (grub_video_sm712_init) + (grub_video_video_init, grub_video_bitmap_init) + (grub_font_manager_init, grub_term_gfxterm_init) + (grub_at_keyboard_init): New extern declarations. + (grub_machine_init): Initialize gfxterm and at_keyboard. + + * kern/main.c (grub_main): Revert grub_printf delay kludge. + + * util/grub-install.in: Revert embed of `at_keyboard.mod' and + `gfxterm.mod' into core image. + + * conf/mips.rmk (pkglib_IMAGES, kernel_img_SOURCES) + (kernel_img_CFLAGS, kernel_img_ASFLAGS, kernel_img_LDFLAGS) + (kernel_img_FORMAT): Copy to ... + + * conf/mips-qemu-mips.rmk (pkglib_IMAGES, kernel_img_SOURCES) + (kernel_img_CFLAGS, kernel_img_ASFLAGS, kernel_img_LDFLAGS) + (kernel_img_FORMAT): ... here, and ... + + * conf/mips-yeeloong.rmk (pkglib_IMAGES, kernel_img_SOURCES) + (kernel_img_CFLAGS, kernel_img_ASFLAGS, kernel_img_LDFLAGS) + (kernel_img_FORMAT): ... here. + + (kernel_img_SOURCES): Add files necessary for output (gfxterm) + and input (at_keyboard) terminals in kernel. + (kernel_img_CFLAGS): Add `-DUSE_ASCII_FAILBACK'. + + (pkglib_MODULES): Remove `pci.mod'. + (pci_mod_SOURCES, pci_mod_CFLAGS, pci_mod_LDFLAGS) + (sm712_mod_SOURCES, sm712_mod_CFLAGS, sm712_mod_LDFLAGS) + (at_keyboard_mod_SOURCES, at_keyboard_mod_CFLAGS) + (at_keyboard_mod_LDFLAGS): Remove variables. + 2010-01-11 Felix Zielcke * po/POTFILES: Replace `term/i386/pc/serial.c' with `term/serial.c'. diff --git a/conf/mips-qemu-mips.rmk b/conf/mips-qemu-mips.rmk index d5a985a13..e06370122 100644 --- a/conf/mips-qemu-mips.rmk +++ b/conf/mips-qemu-mips.rmk @@ -4,3 +4,20 @@ target_machine=qemu-mips COMMON_CFLAGS += -march=mips3 COMMON_ASFLAGS += -march=mips3 include $(srcdir)/conf/mips.mk + +pkglib_IMAGES = kernel.img +kernel_img_SOURCES = kern/$(target_cpu)/startup.S \ + kern/main.c kern/device.c kern/$(target_cpu)/init.c \ + kern/$(target_cpu)/$(target_machine)/init.c \ + kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \ + kern/misc.c kern/mm.c kern/term.c \ + kern/rescue_parser.c kern/rescue_reader.c \ + kern/list.c kern/handler.c kern/command.c kern/corecmd.c \ + kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \ + kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \ + symlist.c kern/$(target_cpu)/cache.S +kernel_img_CFLAGS = $(COMMON_CFLAGS) +kernel_img_ASFLAGS = $(COMMON_ASFLAGS) +kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \ + -Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic +kernel_img_FORMAT = binary diff --git a/conf/mips-yeeloong.rmk b/conf/mips-yeeloong.rmk index 4257bba74..964f29384 100644 --- a/conf/mips-yeeloong.rmk +++ b/conf/mips-yeeloong.rmk @@ -5,11 +5,30 @@ COMMON_CFLAGS += -march=mips3 COMMON_ASFLAGS += -march=mips3 include $(srcdir)/conf/mips.mk -# For pci.mod. -pkglib_MODULES += pci.mod -pci_mod_SOURCES = bus/pci.c bus/bonito.c -pci_mod_CFLAGS = $(COMMON_CFLAGS) -pci_mod_LDFLAGS = $(COMMON_LDFLAGS) +pkglib_IMAGES = kernel.img +kernel_img_SOURCES = kern/$(target_cpu)/startup.S \ + kern/main.c kern/device.c kern/$(target_cpu)/init.c \ + kern/$(target_cpu)/$(target_machine)/init.c \ + kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \ + kern/misc.c kern/mm.c kern/term.c \ + kern/rescue_parser.c kern/rescue_reader.c \ + kern/list.c kern/handler.c kern/command.c kern/corecmd.c \ + kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \ + kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \ + kern/$(target_cpu)/cache.S \ + \ + term/at_keyboard.c \ + font/font_cmd.c font/font.c io/bufio.c \ + video/video.c video/fb/video_fb.c video/fb/fbblit.c \ + video/fb/fbfill.c video/fb/fbutil.c video/bitmap.c \ + video/sm712.c bus/pci.c bus/bonito.c \ + term/gfxterm.c commands/extcmd.c lib/arg.c \ + symlist.c +kernel_img_CFLAGS = $(COMMON_CFLAGS) -DUSE_ASCII_FAILBACK +kernel_img_ASFLAGS = $(COMMON_ASFLAGS) +kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \ + -Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic +kernel_img_FORMAT = binary # For ata.mod. pkglib_MODULES += ata.mod @@ -17,24 +36,12 @@ ata_mod_SOURCES = disk/ata.c ata_mod_CFLAGS = $(COMMON_CFLAGS) ata_mod_LDFLAGS = $(COMMON_LDFLAGS) -# For pci.mod. -pkglib_MODULES += sm712.mod -sm712_mod_SOURCES = video/sm712.c -sm712_mod_CFLAGS = $(COMMON_CFLAGS) -sm712_mod_LDFLAGS = $(COMMON_LDFLAGS) - # For lspci.mod pkglib_MODULES += lspci.mod lspci_mod_SOURCES = commands/lspci.c lspci_mod_CFLAGS = $(COMMON_CFLAGS) lspci_mod_LDFLAGS = $(COMMON_LDFLAGS) -# For at_keyboard.mod. -pkglib_MODULES += at_keyboard.mod -at_keyboard_mod_SOURCES = term/at_keyboard.c -at_keyboard_mod_CFLAGS = $(COMMON_CFLAGS) -at_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS) - # For ata_pthru.mod. pkglib_MODULES += ata_pthru.mod ata_pthru_mod_SOURCES = disk/ata_pthru.c diff --git a/conf/mips.rmk b/conf/mips.rmk index 55fd83d73..fedfb4c54 100644 --- a/conf/mips.rmk +++ b/conf/mips.rmk @@ -25,24 +25,6 @@ symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist. kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh /bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1) -# Programs -pkglib_IMAGES = kernel.img -kernel_img_SOURCES = kern/$(target_cpu)/startup.S \ - kern/main.c kern/device.c kern/$(target_cpu)/init.c \ - kern/$(target_cpu)/$(target_machine)/init.c \ - kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \ - kern/misc.c kern/mm.c kern/term.c \ - kern/rescue_parser.c kern/rescue_reader.c \ - kern/list.c kern/handler.c kern/command.c kern/corecmd.c \ - kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \ - kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \ - symlist.c kern/$(target_cpu)/cache.S -kernel_img_CFLAGS = $(COMMON_CFLAGS) -kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \ - -Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic -kernel_img_FORMAT = binary - # Scripts. sbin_SCRIPTS = bin_SCRIPTS = diff --git a/kern/main.c b/kern/main.c index ae32d47f6..57a0f4a3d 100644 --- a/kern/main.c +++ b/kern/main.c @@ -152,6 +152,12 @@ grub_main (void) /* First of all, initialize the machine. */ grub_machine_init (); + /* Hello. */ + grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); + grub_printf ("Welcome to GRUB!\n\n"); + grub_refresh (); + grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); + /* Load pre-loaded modules and free the space. */ grub_register_exported_symbols (); #ifdef GRUB_LINKER_HAVE_INIT @@ -159,12 +165,6 @@ grub_main (void) #endif grub_load_modules (); - /* Hello. */ - grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); - grub_printf ("Welcome to GRUB!\n\n"); - grub_refresh (); - grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); - /* It is better to set the root device as soon as possible, for convenience. */ grub_machine_set_prefix (); diff --git a/kern/mips/yeeloong/init.c b/kern/mips/yeeloong/init.c index 8b93ac18f..14e8a39a2 100644 --- a/kern/mips/yeeloong/init.c +++ b/kern/mips/yeeloong/init.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2009 Free Software Foundation, Inc. + * Copyright (C) 2009,2010 Free Software Foundation, Inc. * * GRUB is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +28,13 @@ #include #include +extern void grub_video_sm712_init (void); +extern void grub_video_video_init (void); +extern void grub_video_bitmap_init (void); +extern void grub_font_manager_init (void); +extern void grub_term_gfxterm_init (void); +extern void grub_at_keyboard_init (void); + /* FIXME: use interrupt to count high. */ grub_uint64_t grub_get_rtc (void) @@ -87,6 +94,16 @@ grub_machine_init (void) - (((grub_addr_t) modend) - GRUB_ARCH_LOWMEMVSTART)); /* FIXME: use upper memory as well. */ grub_install_get_time_ms (grub_rtc_get_time_ms); + + /* Initialize output terminal (can't be done earlier, as gfxterm + relies on a working heap. */ + grub_video_sm712_init (); + grub_video_video_init (); + grub_video_bitmap_init (); + grub_font_manager_init (); + grub_term_gfxterm_init (); + + grub_at_keyboard_init (); } void diff --git a/util/grub-install.in b/util/grub-install.in index 509593d63..bb323d706 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -292,10 +292,6 @@ partmap_module=`$grub_probe --target=partmap --device ${grub_device} 2> /dev/nul # Device abstraction module, if any (lvm, raid). devabstraction_module=`$grub_probe --target=abstraction --device ${grub_device}` -if [ "${target_cpu}-${platform}" = "mips-yeeloong" ] ; then - modules="sm712 gfxterm at_keyboard $modules" -fi - # The order in this list is critical. Be careful when modifying it. modules="$modules $disk_module" modules="$modules $fs_module $partmap_module $devabstraction_module"