8231fb77c6
2009-06-27 Robert Millan <rmh.grub@aybabtu.com> * include/grub/dl.h: Include grub/elf.h. (struct grub_dl): Add symtab field. * kern/dl.c [GRUB_MACHINE_QEMU]: Define GRUB_MODULES_MACHINE_READONLY. (grub_dl_resolve_symbols): Populate mod->symtab, making a copy of the header for read-only modules. (grub_dl_unload): Free mod->symtab for read-only modules. * kern/i386/dl.c: Use mod->symtab. * kern/powerpc/dl.c: Likewise. * kern/sparc64/dl.c: Likewise. * kern/x86_64/dl.c: Likewise. * conf/i386-qemu.rmk: New file. * kern/i386/qemu/startup.S: Likewise. * kern/i386/qemu/mmap.c: Likewise. * boot/i386/qemu/boot.S: Likewise. * include/grub/i386/qemu/time.h: Likewise. * include/grub/i386/qemu/serial.h: Likewise. * include/grub/i386/qemu/kernel.h: Likewise. * include/grub/i386/qemu/console.h: Likewise. * include/grub/i386/qemu/boot.h: Likewise. * include/grub/i386/qemu/init.h: Likewise. * include/grub/i386/qemu/machine.h: Likewise. * include/grub/i386/qemu/loader.h: Likewise. * include/grub/i386/qemu/memory.h: Likewise. * conf/i386-coreboot.rmk (GRUB_BOOT_MACHINE_LINK_ADDR) (GRUB_KERNEL_MACHINE_LINK_ADDR): New variables. [qemu] (pkglib_IMAGES): Add `boot.img'. [qemu] (boot_img_SOURCES, boot_img_ASFLAGS, boot_img_LDFLAGS) [qemu] (boot_img_FORMAT): New variables. [qemu] (bin_UTILITIES): Add `grub-mkimage'. [qemu] (grub_mkimage_SOURCES, grub_mkimage_CFLAGS): New variables. [qemu] (kernel_img_SOURCES, kernel_img_HEADERS, kernel_img_CFLAGS) [qemu] (kernel_img_ASFLAGS, kernel_img_LDFLAGS) [qemu] (kernel_img_FORMAT): New variables. * configure.ac: Recognise `i386-qemu'. * util/i386/pc/grub-mkimage.c (compress_kernel): Add dummy variant (for no compression). [GRUB_MACHINE_QEMU] (generate_image): Misc adjustments to produce a valid i386 ROM image. Make `GRUB_KERNEL_MACHINE_COMPRESSED_SIZE', `GRUB_KERNEL_MACHINE_INSTALL_DOS_PART' and `GRUB_KERNEL_MACHINE_INSTALL_BSD_PART' optional features (with ifdefs).
253 lines
8.6 KiB
Makefile
253 lines
8.6 KiB
Makefile
# -*- makefile -*-
|
|
|
|
COMMON_ASFLAGS = -nostdinc -fno-builtin -m32
|
|
COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
|
|
COMMON_LDFLAGS = -m32 -nostdlib
|
|
|
|
# Used by various components. These rules need to precede them.
|
|
script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
|
|
# Images.
|
|
|
|
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
|
|
|
ifeq ($(platform), coreboot)
|
|
|
|
pkglib_PROGRAMS += kernel.img
|
|
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
|
kern/i386/misc.S \
|
|
kern/i386/coreboot/init.c \
|
|
kern/i386/multiboot_mmap.c \
|
|
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/reader.c kern/term.c \
|
|
kern/rescue_parser.c kern/rescue_reader.c \
|
|
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
kern/i386/dl.c kern/parser.c kern/partition.c \
|
|
kern/i386/tsc.c kern/i386/pit.c \
|
|
kern/generic/rtc_get_time_ms.c \
|
|
kern/generic/millisleep.c \
|
|
kern/env.c \
|
|
term/i386/pc/vga_text.c term/i386/vga_common.c \
|
|
symlist.c
|
|
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 loader.h misc.h mm.h net.h parser.h \
|
|
partition.h pc_partition.h reader.h symbol.h term.h time.h types.h \
|
|
machine/boot.h machine/console.h machine/init.h \
|
|
machine/memory.h machine/loader.h list.h handler.h command.h
|
|
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
|
|
|
|
endif
|
|
|
|
ifeq ($(platform), qemu)
|
|
|
|
GRUB_BOOT_MACHINE_LINK_ADDR = 0xffe00
|
|
|
|
pkglib_IMAGES += boot.img
|
|
boot_img_SOURCES = boot/i386/qemu/boot.S
|
|
boot_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
|
boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
|
boot_img_FORMAT = binary
|
|
|
|
bin_UTILITIES += grub-mkimage
|
|
grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
|
|
util/resolve.c
|
|
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
|
|
|
pkglib_IMAGES += kernel.img
|
|
kernel_img_SOURCES = kern/i386/qemu/startup.S \
|
|
kern/i386/misc.S \
|
|
kern/i386/coreboot/init.c \
|
|
kern/i386/qemu/mmap.c \
|
|
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/reader.c kern/term.c \
|
|
kern/rescue_parser.c kern/rescue_reader.c \
|
|
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
kern/i386/dl.c kern/parser.c kern/partition.c \
|
|
kern/i386/tsc.c kern/i386/pit.c \
|
|
kern/generic/rtc_get_time_ms.c \
|
|
kern/generic/millisleep.c \
|
|
kern/env.c \
|
|
term/i386/pc/vga_text.c term/i386/vga_common.c \
|
|
symlist.c
|
|
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 loader.h misc.h mm.h net.h parser.h \
|
|
partition.h pc_partition.h reader.h symbol.h term.h time.h types.h \
|
|
machine/boot.h machine/console.h machine/init.h \
|
|
machine/memory.h machine/loader.h list.h handler.h command.h
|
|
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
|
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
|
kernel_img_FORMAT = binary
|
|
endif
|
|
|
|
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
|
DEFSYMFILES += kernel_syms.lst
|
|
|
|
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
|
/bin/sh gensymlist.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
|
|
kernel_syms.lst: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h genkernsyms.sh
|
|
/bin/sh genkernsyms.sh $(filter %.h,$^) > $@ || (rm -f $@; exit 1)
|
|
|
|
# Utilities.
|
|
sbin_UTILITIES = grub-mkdevicemap
|
|
ifeq ($(enable_grub_emu), yes)
|
|
sbin_UTILITIES += grub-emu
|
|
endif
|
|
|
|
# For grub-mkdevicemap.
|
|
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
|
|
util/devicemap.c util/misc.c
|
|
|
|
# For grub-emu.
|
|
util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
|
|
grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c \
|
|
commands/configfile.c commands/echo.c commands/help.c \
|
|
commands/handler.c commands/ls.c commands/test.c \
|
|
commands/search.c commands/blocklist.c commands/hexdump.c \
|
|
commands/gptsync.c commands/probe.c commands/xnu_uuid.c \
|
|
lib/hexdump.c commands/i386/cpuid.c \
|
|
disk/host.c disk/loopback.c \
|
|
\
|
|
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
|
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
|
fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c fs/sfs.c \
|
|
fs/ufs.c fs/xfs.c fs/afs.c fs/tar.c \
|
|
\
|
|
fs/fshelp.c \
|
|
io/gzio.c \
|
|
kern/device.c kern/disk.c kern/dl.c kern/elf.c kern/env.c \
|
|
kern/err.c kern/list.c kern/handler.c \
|
|
kern/command.c kern/corecmd.c commands/extcmd.c kern/file.c \
|
|
kern/fs.c commands/boot.c kern/main.c kern/misc.c kern/parser.c \
|
|
kern/partition.c kern/reader.c kern/term.c \
|
|
kern/rescue_reader.c kern/rescue_parser.c \
|
|
lib/arg.c normal/cmdline.c normal/misc.c \
|
|
normal/handler.c normal/autofs.c \
|
|
normal/completion.c normal/datetime.c normal/main.c \
|
|
normal/menu_text.c \
|
|
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
|
|
normal/color.c \
|
|
script/sh/main.c script/sh/execute.c script/sh/function.c \
|
|
script/sh/lexer.c script/sh/script.c grub_script.tab.c \
|
|
partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
|
|
partmap/acorn.c partmap/gpt.c \
|
|
util/console.c util/hostfs.c util/grub-emu.c util/misc.c \
|
|
util/hostdisk.c util/getroot.c \
|
|
util/i386/pc/misc.c \
|
|
\
|
|
disk/raid.c disk/raid5_recover.c disk/raid6_recover.c \
|
|
disk/mdraid_linux.c disk/dmraid_nvidia.c disk/lvm.c \
|
|
commands/parttool.c parttool/pcpart.c \
|
|
grub_emu_init.c
|
|
|
|
grub_emu_LDFLAGS = $(LIBCURSES)
|
|
|
|
sbin_SCRIPTS += grub-install
|
|
grub_install_SOURCES = util/i386/pc/grub-install.in
|
|
|
|
# Modules.
|
|
pkglib_MODULES = linux.mod multiboot.mod \
|
|
aout.mod play.mod serial.mod ata.mod \
|
|
memdisk.mod pci.mod lspci.mod reboot.mod \
|
|
halt.mod datetime.mod date.mod datehook.mod \
|
|
lsmmap.mod mmap.mod
|
|
|
|
# For boot.mod.
|
|
pkglib_MODULES += boot.mod
|
|
boot_mod_SOURCES = commands/boot.c
|
|
boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For mmap.mod.
|
|
mmap_mod_SOURCES = mmap/mmap.c mmap/i386/uppermem.c mmap/i386/mmap.c
|
|
mmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
mmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
mmap_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
|
|
# For linux.mod.
|
|
linux_mod_SOURCES = loader/i386/linux.c
|
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For reboot.mod.
|
|
reboot_mod_SOURCES = commands/reboot.c kern/i386/reboot.c
|
|
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For halt.mod.
|
|
halt_mod_SOURCES = commands/halt.c kern/i386/halt.c
|
|
halt_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
halt_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For serial.mod.
|
|
serial_mod_SOURCES = term/i386/pc/serial.c
|
|
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For multiboot.mod.
|
|
multiboot_mod_SOURCES = loader/i386/multiboot.c \
|
|
loader/i386/multiboot_helper.S \
|
|
loader/i386/pc/multiboot2.c \
|
|
loader/multiboot2.c \
|
|
loader/multiboot_loader.c
|
|
multiboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
multiboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
multiboot_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
|
|
# For aout.mod.
|
|
aout_mod_SOURCES = loader/aout.c
|
|
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For play.mod.
|
|
play_mod_SOURCES = commands/i386/pc/play.c
|
|
play_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
play_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For ata.mod.
|
|
ata_mod_SOURCES = disk/ata.c
|
|
ata_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
ata_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For memdisk.mod.
|
|
memdisk_mod_SOURCES = disk/memdisk.c
|
|
memdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
memdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For pci.mod
|
|
pci_mod_SOURCES = bus/pci.c
|
|
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For lspci.mod
|
|
lspci_mod_SOURCES = commands/lspci.c
|
|
lspci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
lspci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For datetime.mod
|
|
datetime_mod_SOURCES = lib/i386/datetime.c
|
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For date.mod
|
|
date_mod_SOURCES = commands/date.c
|
|
date_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
date_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For datehook.mod
|
|
datehook_mod_SOURCES = hook/datehook.c
|
|
datehook_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
datehook_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For lsmmap.mod
|
|
lsmmap_mod_SOURCES = commands/lsmmap.c
|
|
lsmmap_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
lsmmap_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
include $(srcdir)/conf/i386.mk
|
|
include $(srcdir)/conf/common.mk
|