d05f0df3eb
* Makefile.in (pkglib_DATA): Add handler.lst. (handler.lst): New rule. * conf/i386-pc.rmk (normal_mod_SOURCES): Add normal/handler.c. * conf/i386-coreboot.rmk: Likewise. * conf/i386-ieee1275.rmk: Likewise. * conf/i386-efi.rmk: Likewise. * conf/x86_64-efi.rmk: Likewise. * conf/powerpc-ieee1275.rmk: Likewise. * conf/sparc64-ieee1275.rmk: Likewise. * genhandlerlist.sh: New file. * genmk.rb: Add rules to generate handler.lst. * include/grub/normal.h (grub_file_getline): New function definition. (read_handler_list): Likewise. (free_handler_list): Likewise. * include/grub/term.h (grub_term_register_input): Add name parameter for auto generation of handler.lst. (grub_term_register_output): Likewise. * normal/handler.c: New file. * normal/main.c (get_line): Renamed to grub_file_getline. (read_config_file): Use the newly renamed grub_file_getline. (read_command_list): Likewise. (read_fs_list): Likewise. (grub_normal_execute): Call read_handler_list to parse handler.lst. (GRUB_MOD_FINI): Call free_handler_list to free handler list. * term/efi/console.c (grub_console_init): Add name parameter for auto generation of handler.lst. * term/gfxterm.c: Likewise. * term/i386/pc/at_keyboard.c: Likewise. * term/i386/pc/console.c: Likewise. * term/i386/pc/serial.c: Likewise. * term/i386/pc/vesafb.c: Likewise. * term/i386/pc/vga.c: Likewise. * term/i386/pc/vga_text.c: Likewise. * term/ieee1275/ofconsole.c: Likewise. * term/usb_keyboard.c: Likewise.
379 lines
12 KiB
Makefile
379 lines
12 KiB
Makefile
# -*- makefile -*-
|
|
|
|
GRUB_MEMORY_MACHINE_LINK_ADDR = 0x8200
|
|
|
|
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.
|
|
normal/lexer.c_DEPENDENCIES = grub_script.tab.h
|
|
|
|
# Images.
|
|
pkglib_IMAGES = boot.img diskboot.img kernel.img pxeboot.img lnxboot.img \
|
|
cdboot.img
|
|
|
|
# For boot.img.
|
|
boot_img_SOURCES = boot/i386/pc/boot.S
|
|
boot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,7C00
|
|
boot_img_FORMAT = binary
|
|
|
|
# For pxeboot.img
|
|
pxeboot_img_SOURCES = boot/i386/pc/pxeboot.S
|
|
pxeboot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
pxeboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,7C00
|
|
pxeboot_img_FORMAT = binary
|
|
|
|
# For diskboot.img.
|
|
diskboot_img_SOURCES = boot/i386/pc/diskboot.S
|
|
diskboot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
diskboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,8000
|
|
diskboot_img_FORMAT = binary
|
|
|
|
# For lnxboot.img.
|
|
lnxboot_img_SOURCES = boot/i386/pc/lnxboot.S
|
|
lnxboot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
lnxboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,6000
|
|
lnxboot_img_FORMAT = binary
|
|
|
|
# For cdboot.img.
|
|
cdboot_img_SOURCES = boot/i386/pc/cdboot.S
|
|
cdboot_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
cdboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,7C00
|
|
cdboot_img_FORMAT = binary
|
|
|
|
# For kernel.img.
|
|
kernel_img_SOURCES = kern/i386/pc/startup.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 \
|
|
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
|
kern/i386/dl.c kern/i386/pc/init.c kern/i386/pc/mmap.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/console.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 rescue.h symbol.h term.h time.h types.h \
|
|
machine/biosdisk.h machine/boot.h machine/console.h machine/init.h \
|
|
machine/memory.h machine/loader.h machine/vga.h machine/vbe.h \
|
|
machine/kernel.h machine/pxe.h list.h handler.h command.h
|
|
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS) -Wl,-Ttext,$(GRUB_MEMORY_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
|
|
kernel_img_FORMAT = binary
|
|
|
|
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.
|
|
bin_UTILITIES = grub-mkimage
|
|
sbin_UTILITIES = grub-setup grub-mkdevicemap
|
|
ifeq ($(enable_grub_emu), yes)
|
|
sbin_UTILITIES += grub-emu
|
|
endif
|
|
|
|
# For grub-mkimage.
|
|
ifeq ($(enable_lzo), yes)
|
|
grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
|
|
util/resolve.c
|
|
grub_mkimage_LDFLAGS = $(LIBLZO)
|
|
else
|
|
grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
|
|
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
|
|
endif
|
|
grub_mkimage_CFLAGS = -DGRUB_MEMORY_MACHINE_LINK_ADDR=$(GRUB_MEMORY_MACHINE_LINK_ADDR)
|
|
util/i386/pc/grub-mkimage.c_DEPENDENCIES = Makefile
|
|
|
|
# For grub-setup.
|
|
util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
|
grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c \
|
|
util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
|
kern/err.c kern/misc.c kern/parser.c kern/partition.c \
|
|
kern/file.c kern/fs.c kern/env.c fs/fshelp.c \
|
|
\
|
|
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.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 \
|
|
\
|
|
partmap/pc.c partmap/gpt.c \
|
|
\
|
|
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
|
util/raid.c util/lvm.c \
|
|
grub_setup_init.c
|
|
|
|
# For grub-mkdevicemap.
|
|
grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.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 \
|
|
lib/hexdump.c commands/i386/pc/halt.c commands/reboot.c \
|
|
commands/i386/cpuid.c \
|
|
disk/host.c disk/loopback.c disk/scsi.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 \
|
|
normal/execute.c kern/file.c kern/fs.c normal/lexer.c \
|
|
kern/loader.c kern/main.c kern/misc.c kern/parser.c \
|
|
grub_script.tab.c kern/partition.c kern/rescue.c kern/term.c \
|
|
lib/arg.c normal/cmdline.c normal/command.c normal/datetime.c \
|
|
normal/function.c \
|
|
normal/completion.c normal/main.c normal/color.c \
|
|
normal/menu.c normal/menu_entry.c normal/menu_viewer.c \
|
|
normal/menu_text.c \
|
|
normal/misc.c normal/script.c \
|
|
partmap/amiga.c partmap/apple.c partmap/pc.c partmap/sun.c \
|
|
partmap/acorn.c partmap/gpt.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 \
|
|
\
|
|
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)
|
|
|
|
ifeq ($(enable_grub_emu_usb), yes)
|
|
grub_emu_SOURCES += disk/usbms.c util/usb.c bus/usb/usb.c \
|
|
commands/usbtest.c
|
|
grub_emu_LDFLAGS += $(LIBCURSES) $(LIBUSB)
|
|
endif
|
|
|
|
# Scripts.
|
|
sbin_SCRIPTS = grub-install
|
|
bin_SCRIPTS = grub-mkrescue
|
|
|
|
# For grub-install.
|
|
grub_install_SOURCES = util/i386/pc/grub-install.in
|
|
|
|
# For grub-mkrescue.
|
|
grub_mkrescue_SOURCES = util/i386/pc/grub-mkrescue.in
|
|
|
|
pkglib_MODULES = biosdisk.mod chain.mod normal.mod \
|
|
multiboot.mod reboot.mod halt.mod \
|
|
vbe.mod vbetest.mod vbeinfo.mod play.mod serial.mod \
|
|
ata.mod vga.mod memdisk.mod pci.mod lspci.mod \
|
|
aout.mod bsd.mod pxe.mod pxecmd.mod datetime.mod date.mod \
|
|
datehook.mod lsmmap.mod ata_pthru.mod hdparm.mod \
|
|
usb.mod uhci.mod ohci.mod usbtest.mod usbms.mod usb_keyboard.mod
|
|
|
|
# For biosdisk.mod.
|
|
biosdisk_mod_SOURCES = disk/i386/pc/biosdisk.c
|
|
biosdisk_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
biosdisk_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For chain.mod.
|
|
chain_mod_SOURCES = loader/i386/pc/chainloader.c
|
|
chain_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
chain_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
pkglib_MODULES += linux16.mod
|
|
linux16_mod_SOURCES = loader/i386/pc/linux.c
|
|
linux16_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
linux16_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
pkglib_MODULES += linux.mod
|
|
linux_mod_SOURCES = loader/i386/linux.c
|
|
linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
#
|
|
# Only arch dependant part of normal.mod will be here. Common part for
|
|
# all architecures of normal.mod is at start and should be kept at sync
|
|
# with other makefiles.
|
|
#
|
|
# Please put arch dependant part of normal.mod at the end of list to
|
|
# keep it simpler to update to different architectures.
|
|
#
|
|
normal_mod_SOURCES = normal/cmdline.c normal/command.c normal/datetime.c \
|
|
normal/completion.c normal/execute.c normal/handler.c \
|
|
normal/function.c normal/lexer.c normal/main.c normal/menu.c \
|
|
normal/menu_text.c \
|
|
normal/color.c \
|
|
normal/menu_viewer.c normal/menu_entry.c \
|
|
normal/misc.c grub_script.tab.c \
|
|
normal/script.c \
|
|
normal/i386/setjmp.S
|
|
normal_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
normal_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
|
normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For reboot.mod.
|
|
reboot_mod_SOURCES = commands/reboot.c
|
|
reboot_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
reboot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For halt.mod.
|
|
halt_mod_SOURCES = commands/i386/pc/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 vbe.mod.
|
|
vbe_mod_SOURCES = video/i386/pc/vbe.c video/i386/pc/vbeblit.c \
|
|
video/i386/pc/vbefill.c video/i386/pc/vbeutil.c
|
|
vbe_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
vbe_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For vbeinfo.mod.
|
|
vbeinfo_mod_SOURCES = commands/i386/pc/vbeinfo.c
|
|
vbeinfo_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
vbeinfo_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For vbetest.mod.
|
|
vbetest_mod_SOURCES = commands/i386/pc/vbetest.c
|
|
vbetest_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
vbetest_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 vga.mod.
|
|
vga_mod_SOURCES = term/i386/pc/vga.c
|
|
vga_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
vga_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 aout.mod
|
|
aout_mod_SOURCES = loader/aout.c
|
|
aout_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
aout_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For bsd.mod
|
|
bsd_mod_SOURCES = loader/i386/bsd.c
|
|
bsd_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
bsd_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For usb.mod
|
|
usb_mod_SOURCES = bus/usb/usb.c bus/usb/usbtrans.c bus/usb/usbhub.c
|
|
usb_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
usb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For usbtest.mod
|
|
usbtest_mod_SOURCES = commands/usbtest.c
|
|
usbtest_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
usbtest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For uhci.mod
|
|
uhci_mod_SOURCES = bus/usb/uhci.c
|
|
uhci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
uhci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For ohci.mod
|
|
ohci_mod_SOURCES = bus/usb/ohci.c
|
|
ohci_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
ohci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For usbms.mod
|
|
usbms_mod_SOURCES = disk/usbms.c
|
|
usbms_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
usbms_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For usb_keyboard.mod
|
|
usb_keyboard_mod_SOURCES = term/usb_keyboard.c
|
|
usb_keyboard_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
usb_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For pxe.mod
|
|
pxe_mod_SOURCES = fs/i386/pc/pxe.c
|
|
pxe_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
pxe_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For pxecmd.mod
|
|
pxecmd_mod_SOURCES = commands/i386/pc/pxecmd.c
|
|
pxecmd_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
pxecmd_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)
|
|
|
|
# For ata_pthru.mod.
|
|
ata_pthru_mod_SOURCES = disk/ata_pthru.c
|
|
ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
ata_pthru_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
# For hdparm.mod.
|
|
hdparm_mod_SOURCES = commands/hdparm.c lib/hexdump.c
|
|
hdparm_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
hdparm_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
|
|
include $(srcdir)/conf/i386.mk
|
|
include $(srcdir)/conf/common.mk
|