From: BVK Chaitanya Date: Thu, 26 Aug 2010 04:00:11 +0000 (+0530) Subject: merge with mainline X-Git-Tag: 1.99~600^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=928bad4708cc6ad631770b9d837cb6858b564083;p=thirdparty%2Fgrub.git merge with mainline --- 928bad4708cc6ad631770b9d837cb6858b564083 diff --cc Makefile.util.def index 000000000,fd3428e76..9fffa5b1f mode 000000,100644..100644 --- a/Makefile.util.def +++ b/Makefile.util.def @@@ -1,0 -1,510 +1,516 @@@ + AutoGen definitions Makefile.tpl; + + library = { + name = libgrub.a; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + + common_nodist = grub_script.tab.c; + common_nodist = grub_script.yy.c; + common_nodist = libgrub_a_init.c; + common_nodist = grub_script.yy.h; + common_nodist = grub_script.tab.h; + + common = grub-core/gnulib/error.c; + common = grub-core/gnulib/fnmatch.c; + common = grub-core/gnulib/getdelim.c; + common = grub-core/gnulib/getline.c; + common = grub-core/gnulib/getopt1.c; + common = grub-core/gnulib/getopt.c; + common = grub-core/gnulib/progname.c; + + common = util/misc.c; + common = grub-core/kern/misc.c; + common = grub-core/kern/emu/mm.c; + common = grub-core/kern/emu/misc.c; + common = grub-core/kern/emu/hostfs.c; + common = grub-core/kern/emu/getroot.c; + common = grub-core/kern/emu/hostdisk.c; + + common = grub-core/commands/blocklist.c; + common = grub-core/commands/extcmd.c; + common = grub-core/commands/ls.c; + common = grub-core/disk/dmraid_nvidia.c; + common = grub-core/disk/host.c; + common = grub-core/disk/loopback.c; + common = grub-core/disk/lvm.c; + common = grub-core/disk/mdraid_linux.c; + common = grub-core/disk/raid5_recover.c; + common = grub-core/disk/raid6_recover.c; + common = grub-core/disk/raid.c; + common = grub-core/fs/affs.c; + common = grub-core/fs/afs_be.c; + common = grub-core/fs/afs.c; + common = grub-core/fs/befs_be.c; + common = grub-core/fs/befs.c; + common = grub-core/fs/cpio.c; + common = grub-core/fs/ext2.c; + common = grub-core/fs/fat.c; + common = grub-core/fs/fshelp.c; + common = grub-core/fs/hfs.c; + common = grub-core/fs/hfsplus.c; + common = grub-core/fs/iso9660.c; + common = grub-core/fs/jfs.c; + common = grub-core/fs/minix.c; + common = grub-core/fs/nilfs2.c; + common = grub-core/fs/ntfs.c; + common = grub-core/fs/ntfscomp.c; + common = grub-core/fs/reiserfs.c; + common = grub-core/fs/sfs.c; + common = grub-core/fs/tar.c; + common = grub-core/fs/udf.c; + common = grub-core/fs/ufs2.c; + common = grub-core/fs/ufs.c; + common = grub-core/fs/xfs.c; + common = grub-core/kern/command.c; + common = grub-core/kern/device.c; + common = grub-core/kern/disk.c; + common = grub-core/kern/env.c; + common = grub-core/kern/err.c; + common = grub-core/kern/file.c; + common = grub-core/kern/fs.c; + common = grub-core/kern/list.c; + common = grub-core/kern/partition.c; + common = grub-core/lib/arg.c; + common = grub-core/lib/crc.c; + common = grub-core/lib/crypto.c; + common = grub-core/lib/envblk.c; + common = grub-core/lib/hexdump.c; + common = grub-core/lib/libgcrypt-grub/cipher/sha512.c; + common = grub-core/lib/LzFind.c; + common = grub-core/lib/LzmaEnc.c; + common = grub-core/lib/pbkdf2.c; + common = grub-core/normal/datetime.c; + common = grub-core/normal/misc.c; + common = grub-core/partmap/acorn.c; + common = grub-core/partmap/amiga.c; + common = grub-core/partmap/apple.c; + common = grub-core/partmap/gpt.c; + common = grub-core/partmap/msdos.c; + common = grub-core/partmap/sun.c; + common = grub-core/script/function.c; + common = grub-core/script/lexer.c; + common = grub-core/script/main.c; + common = grub-core/script/script.c; + common = grub-core/script/argv.c; + }; + + program = { + name = grub-bin2h; + common = util/bin2h.c; + ldadd = libgrub.a; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; + mansection = 1; + }; + + program = { + name = grub-mkimage; + mansection = 1; + + common = util/grub-mkimage.c; + common = util/resolve.c; + extra_dist = util/grub-mkimagexx.c; + + ldadd = libgrub.a; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; + cppflags = '-DGRUB_PKGLIBROOTDIR=\"$(pkglibrootdir)\"'; + }; + + program = { + name = grub-mkrelpath; + mansection = 1; + + common = util/grub-mkrelpath.c; + + ldadd = libgrub.a; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; + }; + + program = { + name = grub-script-check; + mansection = 1; + + common = util/grub-script-check.c; + + ldadd = libgrub.a; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; + }; + + program = { + name = grub-editenv; + mansection = 1; + + common = util/grub-editenv.c; + + ldadd = libgrub.a; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; + }; + + program = { + name = grub-mkpasswd-pbkdf2; + mansection = 1; + + common = util/grub-mkpasswd-pbkdf2.c; + + ldadd = libgrub.a; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; + cflags = '$(CFLAGS_GCRY)'; + cppflags = '$(CPPFLAGS_GCRY)'; + }; + + program = { + name = grub-macho2img; + mansection = 1; + common = util/grub-macho2img.c; + condition = COND_APPLE_CC; + }; + + program = { + name = grub-pe2elf; + mansection = 1; + common = util/grub-pe2elf.c; + + ldadd = libgrub.a; + ldflags = '$(LIBINTL)'; + condition = COND_GRUB_PE2ELF; + }; + + program = { + name = grub-fstest; + mansection = 1; + common = util/grub-fstest.c; + + ldadd = libgrub.a; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; + condition = COND_GRUB_FSTEST; + }; + + program = { + name = grub-mkfont; + mansection = 1; + common = util/grub-mkfont.c; + common = grub-core/unidata.c; + + cflags = '$(freetype_cflags)'; + + ldadd = libgrub.a; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER)'; + ldflags = '$(freetype_libs)'; + condition = COND_GRUB_MKFONT; + }; + + program = { + name = grub-mkdevicemap; + installdir = sbin; + mansection = 8; + + common = util/grub-mkdevicemap.c; + common = util/deviceiter.c; + nosparc64 = util/devicemap.c; + + sparc64_ieee1275 = util/ieee1275/ofpath.c; + sparc64_ieee1275 = util/ieee1275/devicemap.c; + + ldadd = libgrub.a; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)'; + }; + + program = { + name = grub-probe; + installdir = sbin; + mansection = 8; + common = util/grub-probe.c; + + ldadd = libgrub.a; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)'; + }; + + program = { + name = grub-setup; + installdir = sbin; + mansection = 8; + i386_pc = util/i386/pc/grub-setup.c; + i386_pc = util/raid.c; + i386_pc = util/lvm.c; + + sparc64_ieee1275 = util/ieee1275/ofpath.c; + sparc64_ieee1275 = util/sparc64/ieee1275/grub-setup.c; + sparc64_ieee1275 = util/raid.c; + sparc64_ieee1275 = util/lvm.c; + + ldadd = libgrub.a; + ldflags = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)'; + + enable = i386_pc; + enable = sparc64_ieee1275; + }; + + program = { + name = grub-ofpathname; + installdir = sbin; + ieee1275 = util/ieee1275/grub-ofpathname.c; + ieee1275 = util/ieee1275/ofpath.c; + + ldadd = libgrub.a; + enable = sparc64_ieee1275; + }; + + data = { + common = util/grub.d/README; + installdir = grubconf; + }; + + script = { + name = '00_header'; + common = util/grub.d/00_header.in; + installdir = grubconf; + }; + + script = { + name = '10_windows'; + common = util/grub.d/10_windows.in; + installdir = grubconf; + condition = COND_HOST_WINDOWS; + }; + + script = { + name = '10_hurd'; + common = util/grub.d/10_hurd.in; + installdir = grubconf; + condition = COND_HOST_HURD; + }; + + script = { + name = '10_kfreebsd'; + common = util/grub.d/10_kfreebsd.in; + installdir = grubconf; + condition = COND_HOST_KFREEBSD; + }; + + script = { + name = '10_netbsd'; + common = util/grub.d/10_netbsd.in; + installdir = grubconf; + condition = COND_HOST_NETBSD; + }; + + script = { + name = '10_linux'; + common = util/grub.d/10_linux.in; + installdir = grubconf; + condition = COND_HOST_LINUX; + }; + + script = { + name = '20_linux_xen'; + common = util/grub.d/20_linux_xen.in; + installdir = grubconf; + condition = COND_HOST_LINUX; + }; + + script = { + name = '30_os-prober'; + common = util/grub.d/30_os-prober.in; + installdir = grubconf; + }; + + script = { + name = '40_custom'; + common = util/grub.d/40_custom.in; + installdir = grubconf; + }; + + script = { + name = '41_custom'; + common = util/grub.d/41_custom.in; + installdir = grubconf; + }; + + script = { + mansection = 1; + name = grub-mkrescue; + x86_noieee1275 = util/grub-mkrescue.in; + powerpc_ieee1275 = util/powerpc/ieee1275/grub-mkrescue.in; + enable = i386_pc; + enable = x86_efi; + enable = i386_qemu; + enable = i386_coreboot; + enable = powerpc_ieee1275; + }; + + script = { + mansection = 8; + installdir = sbin; + name = grub-install; + + mips = util/grub-install.in; + i386_noefi_noieee1275 = util/grub-install.in; + + x86_efi = util/i386/efi/grub-install.in; + i386_ieee1275 = util/ieee1275/grub-install.in; + powerpc_ieee1275 = util/ieee1275/grub-install.in; + + enable = x86; + enable = mips; + enable = powerpc_ieee1275; + }; + + script = { + name = grub-mkconfig; + common = util/grub-mkconfig.in; + mansection = 8; + installdir = sbin; + }; + + script = { + name = grub-set-default; + common = util/grub-set-default.in; + mansection = 8; + installdir = sbin; + }; + + script = { + name = grub-reboot; + common = util/grub-reboot.in; + mansection = 8; + installdir = sbin; + }; + + script = { + name = grub-mkconfig_lib; + common = util/grub-mkconfig_lib.in; + installdir = noinst; + }; + + script = { + name = update-grub_lib; + common = util/update-grub_lib.in; + installdir = noinst; + }; + + script = { + name = grub-shell; + common = tests/util/grub-shell.in; + installdir = noinst; + }; + + script = { + name = grub-shell-tester; + common = tests/util/grub-shell-tester.in; + installdir = noinst; + }; + + script = { + testcase; + name = example_scripted_test; + common = tests/example_scripted_test.in; + }; + + script = { + testcase; + name = example_grub_script_test; + common = tests/example_grub_script_test.in; + }; + + script = { + testcase; + name = grub_script_echo1; + common = tests/grub_script_echo1.in; + }; + + script = { + testcase; + name = grub_script_echo_keywords; + common = tests/grub_script_echo_keywords.in; + }; + + script = { + testcase; + name = grub_script_vars1; + common = tests/grub_script_vars1.in; + }; + + script = { + testcase; + name = grub_script_for1; + common = tests/grub_script_for1.in; + }; + + script = { + testcase; + name = grub_script_while1; + common = tests/grub_script_while1.in; + }; + + script = { + testcase; + name = grub_script_if; + common = tests/grub_script_if.in; + }; + + script = { + testcase; + name = grub_script_blanklines; + common = tests/grub_script_blanklines.in; + }; + + script = { + testcase; + name = grub_script_final_semicolon; + common = tests/grub_script_final_semicolon.in; + }; + + script = { + testcase; + name = grub_script_dollar; + common = tests/grub_script_dollar.in; + }; + + script = { + testcase; + name = grub_script_comments; + common = tests/grub_script_comments.in; + }; + + script = { + testcase; + name = grub_script_functions; + common = tests/grub_script_functions.in; + }; + + script = { + testcase; + name = grub_script_break; + common = tests/grub_script_break.in; + }; + + script = { + testcase; + name = grub_script_continue; + common = tests/grub_script_continue.in; + }; + + script = { + testcase; + name = grub_script_shift; + common = tests/grub_script_shift.in; + }; + ++script = { ++ testcase; ++ name = grub_script_blockarg; ++ common = tests/grub_script_blockarg.in; ++}; ++ + program = { + testcase; + name = example_unit_test; + common = tests/example_unit_test.c; + common = tests/lib/unit_test.c; + common = grub-core/kern/list.c; + common = grub-core/kern/misc.c; + common = grub-core/tests/lib/test.c; + cflags = -Wno-format; + ldadd = libgrub.a; + ldflags = '$(LIBDEVMAPPER)'; + }; diff --cc grub-core/Makefile.core.def index 000000000,0257bbac4..e8cfe3423 mode 000000,100644..100644 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@@ -1,0 -1,1405 +1,1410 @@@ + AutoGen definitions Makefile.tpl; + + kernel = { + name = kernel; + + nostrip = emu; + + emu_ldflags = '-Wl,-r,-d'; + x86_efi_ldflags = '-Wl,-r,-d'; + x86_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment'; + + i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + + i386_qemu_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + + i386_coreboot_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + i386_multiboot_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + i386_ieee1275_ldflags = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + mips_yeeloong_ldflags = '-Wl,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + powerpc_ieee1275_ldflags = '-Wl,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + + mips_yeeloong_cppflags = '-DUSE_ASCII_FAILBACK'; + i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)'; + i386_qemu_ccasflags = '-DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)'; + emu_cflags = '$(CFLAGS_GNULIB)'; + emu_cppflags = '$(CPPFLAGS_GNULIB)'; + + mips_ldadd = '-lgcc'; + powerpc_ldadd = '-lgcc'; + sparc64_ldadd = '-lgcc'; + + i386_pc_startup = kern/i386/pc/startup.S; + i386_efi_startup = kern/i386/efi/startup.S; + x86_64_efi_startup = kern/x86_64/efi/startup.S; + i386_qemu_startup = kern/i386/qemu/startup.S; + i386_ieee1275_startup = kern/i386/ieee1275/startup.S; + i386_coreboot_multiboot_startup = kern/i386/coreboot/startup.S; + mips_yeeloong_startup = kern/mips/startup.S; + sparc64_ieee1275_startup = kern/sparc64/ieee1275/crt0.S; + powerpc_ieee1275_startup = kern/powerpc/ieee1275/startup.S; + + common = kern/command.c; + common = kern/corecmd.c; + common = kern/device.c; + common = kern/disk.c; + common = kern/dl.c; + common = kern/env.c; + common = kern/err.c; + common = kern/file.c; + common = kern/fs.c; + common = kern/list.c; + common = kern/main.c; + common = kern/misc.c; + common = kern/parser.c; + common = kern/partition.c; + common = kern/rescue_parser.c; + common = kern/rescue_reader.c; + common = kern/term.c; + + noemu = kern/mm.c; + noemu = kern/time.c; + noemu = kern/generic/millisleep.c; + + noemu_nodist = symlist.c; + + noemu_noieee1275 = kern/generic/rtc_get_time_ms.c; + + ieee1275 = disk/ieee1275/ofdisk.c; + ieee1275 = kern/ieee1275/cmain.c; + ieee1275 = kern/ieee1275/ieee1275.c; + ieee1275 = kern/ieee1275/mmap.c; + ieee1275 = kern/ieee1275/openfw.c; + ieee1275 = term/ieee1275/ofconsole.c; + + ieee1275_mips = term/terminfo.c; + ieee1275_mips = term/tparm.c; + + i386 = kern/i386/dl.c; + + i386_coreboot_multiboot_qemu = kern/i386/coreboot/init.c; + i386_coreboot_multiboot_qemu = kern/i386/halt.c; + i386_coreboot_multiboot_qemu = term/i386/pc/vga_text.c; + + i386_pc_coreboot_multiboot_qemu = term/i386/vga_common.c; + + i386_noefi = kern/i386/misc.S; + + x86_noieee1275 = kern/i386/pit.c; + + x86_efi = disk/efi/efidisk.c; + x86_efi = kern/efi/efi.c; + x86_efi = kern/efi/init.c; + x86_efi = kern/efi/mm.c; + x86_efi = kern/i386/efi/init.c; + x86_efi = term/efi/console.c; + + i386_efi = kern/i386/tsc.c; + + x86_64_efi = kern/i386/tsc.c; + x86_64_efi = kern/x86_64/dl.c; + x86_64_efi = kern/x86_64/efi/callwrap.S; + + i386_pc = kern/i386/pc/init.c; + i386_pc = kern/i386/pc/mmap.c; + i386_pc = kern/i386/tsc.c; + i386_pc = term/i386/pc/console.c; + + i386_qemu = bus/pci.c; + i386_qemu = kern/i386/qemu/init.c; + i386_qemu = kern/i386/qemu/mmap.c; + i386_qemu = kern/i386/tsc.c; + + i386_coreboot = kern/i386/coreboot/mmap.c; + i386_coreboot = kern/i386/tsc.c; + + i386_multiboot = kern/i386/multiboot_mmap.c; + i386_multiboot = kern/i386/tsc.c; + + i386_ieee1275 = kern/i386/ieee1275/init.c; + i386_ieee1275 = kern/ieee1275/init.c; + + mips_yeeloong = term/ns8250.c; + mips_yeeloong = bus/bonito.c; + mips_yeeloong = bus/cs5536.c; + mips_yeeloong = bus/pci.c; + mips_yeeloong = commands/extcmd.c; + mips_yeeloong = font/font.c; + mips_yeeloong = font/font_cmd.c; + mips_yeeloong = io/bufio.c; + mips_yeeloong = kern/mips/cache.S; + mips_yeeloong = kern/mips/dl.c; + mips_yeeloong = kern/mips/init.c; + mips_yeeloong = kern/mips/yeeloong/init.c; + mips_yeeloong = lib/arg.c; + mips_yeeloong = term/at_keyboard.c; + mips_yeeloong = term/gfxterm.c; + mips_yeeloong = term/serial.c; + mips_yeeloong = video/bitmap.c; + mips_yeeloong = video/bitmap_scale.c; + mips_yeeloong = video/fb/fbblit.c; + mips_yeeloong = video/fb/fbfill.c; + mips_yeeloong = video/fb/fbutil.c; + mips_yeeloong = video/fb/video_fb.c; + mips_yeeloong = video/sm712.c; + mips_yeeloong = video/video.c; + + powerpc_ieee1275 = kern/ieee1275/init.c; + powerpc_ieee1275 = kern/powerpc/cache.S; + powerpc_ieee1275 = kern/powerpc/dl.c; + + sparc64_ieee1275 = kern/sparc64/cache.S; + sparc64_ieee1275 = kern/sparc64/dl.c; + sparc64_ieee1275 = kern/sparc64/ieee1275/ieee1275.c; + sparc64_ieee1275 = kern/sparc64/ieee1275/init.c; + + emu = disk/host.c; + emu = gnulib/progname.c; + emu = kern/emu/console.c; + emu = kern/emu/getroot.c; + emu = kern/emu/hostdisk.c; + emu = kern/emu/hostfs.c; + emu = kern/emu/main.c; + emu = kern/emu/misc.c; + emu = kern/emu/mm.c; + emu = kern/emu/time.c; + + extra_dist = kern/i386/loader.S; + extra_dist = kern/i386/realmode.S; + extra_dist = kern/i386/pc/lzma_decode.S; + }; + + program = { + name = grub-emu; + mansection = 1; + + emu = kern/emu/full.c; + emu_nodist = grub_emu_init.c; + + ldadd = 'kernel.img$(EXEEXT)'; + ldadd = '$(MODULE_FILES)'; + ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER)'; + + enable = emu; + }; + + program = { + name = grub-emu-lite; + + emu = kern/emu/lite.c; + emu = kern/emu/cache.S; + emu_nodist = symlist.c; + + ldadd = 'kernel.img$(EXEEXT)'; + ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER)'; + + enable = emu; + }; + + image = { + name = boot; + i386_pc = boot/i386/pc/boot.S; + i386_qemu = boot/i386/qemu/boot.S; + sparc64_ieee1275 = boot/sparc64/ieee1275/boot.S; + + i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; + + i386_qemu_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_BOOT_MACHINE_LINK_ADDR)'; + i386_qemu_ccasflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)'; + + sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big'; + sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000'; + + objcopyflags = '-O binary'; + enable = i386_pc; + enable = i386_qemu; + enable = sparc64_ieee1275; + }; + + image = { + name = cdboot; + i386_pc = boot/i386/pc/cdboot.S; + i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; + objcopyflags = '-O binary'; + enable = i386_pc; + }; + + image = { + name = pxeboot; + i386_pc = boot/i386/pc/pxeboot.S; + + i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; + + objcopyflags = '-O binary'; + enable = i386_pc; + }; + + image = { + name = diskboot; + i386_pc = boot/i386/pc/diskboot.S; + + i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x8000'; + + sparc64_ieee1275 = boot/sparc64/ieee1275/diskboot.S; + sparc64_ieee1275_ldflags = '-Wl,-Ttext=0x4200'; + + objcopyflags = '-O binary'; + + enable = i386_pc; + enable = sparc64_ieee1275; + }; + + image = { + name = lnxboot; + i386_pc = boot/i386/pc/lnxboot.S; + + i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)'; + i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x6000'; + + objcopyflags = '-O binary'; + enable = i386_pc; + }; + + image = { + name = fwstart; + mips_yeeloong = boot/mips/yeeloong/fwstart.S; + objcopyflags = '-O binary'; + enable = mips_yeeloong; + }; + + module = { + name = trig; + common_nodist = trigtables.c; + extra_dist = gentrigtables.c; + }; + + module = { + name = cs5536; + x86 = bus/cs5536.c; + enable = x86; + }; + + module = { + name = libusb; + emu = bus/usb/emu/usb.c; + enable = emu; + condition = COND_GRUB_EMU_USB; + }; + + module = { + name = lsspd; + mips_yeeloong = commands/mips/yeeloong/lsspd.c; + enable = mips_yeeloong; + }; + + module = { + name = usb; + common = bus/usb/usb.c; + noemu = bus/usb/usbtrans.c; + noemu = bus/usb/usbhub.c; + enable = emu; + enable = i386; + enable = mips_yeeloong; + emu_condition = COND_GRUB_EMU_USB; + }; + + module = { + name = usbserial_common; + common = bus/usb/serial/common.c; + enable = emu; + enable = i386_pc; + enable = mips_yeeloong; + emu_condition = COND_GRUB_EMU_USB; + }; + + module = { + name = usbserial_pl2303; + common = bus/usb/serial/pl2303.c; + enable = emu; + enable = i386_pc; + enable = mips_yeeloong; + emu_condition = COND_GRUB_EMU_USB; + }; + + module = { + name = usbserial_ftdi; + common = bus/usb/serial/ftdi.c; + enable = emu; + enable = i386_pc; + enable = mips_yeeloong; + emu_condition = COND_GRUB_EMU_USB; + }; + + module = { + name = uhci; + common = bus/usb/uhci.c; + enable = i386_pc; + }; + + module = { + name = ohci; + common = bus/usb/ohci.c; + enable = i386_pc; + enable = mips_yeeloong; + }; + + module = { + name = pci; + noemu = bus/pci.c; + emu = bus/emu/pci.c; + emu = commands/lspci.c; + + enable = emu; + enable = i386_pc; + enable = x86_efi; + enable = i386_ieee1275; + enable = i386_coreboot; + emu_condition = COND_GRUB_EMU_PCI; + }; + + library = { + name = libgnulib.a; + common = gnulib/regex.c; + + extra_dist = gnulib/regcomp.c; + extra_dist = gnulib/regexec.c; + extra_dist = gnulib/fnmatch_loop.c; + extra_dist = gnulib/regex_internal.c; + + cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; + cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; + }; + + module = { + name = cmostest; + i386 = commands/i386/cmostest.c; + enable = i386_pc; + enable = i386_coreboot; + }; + + module = { + name = iorw; + common = commands/iorw.c; + enable = x86; + }; + + module = { + name = regexp; + common = commands/regexp.c; + ldadd = libgnulib.a; + cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)'; + cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)'; + }; + + module = { + name = acpi; + + i386 = commands/acpi.c; + x86_efi = commands/efi/acpi.c; + i386_pc = commands/i386/pc/acpi.c; + + enable = x86_efi; + enable = i386_pc; + }; + + module = { + name = blocklist; + common = commands/blocklist.c; + }; + + module = { + name = boot; + common = commands/boot.c; + i386_pc = lib/i386/pc/biosnum.c; + }; + + module = { + name = cat; + common = commands/cat.c; + }; + + module = { + name = cmp; + common = commands/cmp.c; + }; + + module = { + name = configfile; + common = commands/configfile.c; + }; + + module = { + name = cpuid; + x86 = commands/i386/cpuid.c; + enable = x86; + }; + + module = { + name = crc; + common = commands/crc.c; + common = lib/crc.c; + }; + + module = { + name = date; + common = commands/date.c; + }; + + module = { + name = drivemap; + + i386_pc = commands/i386/pc/drivemap.c; + i386_pc = commands/i386/pc/drivemap_int13h.S; + enable = i386_pc; + }; + + module = { + name = echo; + common = commands/echo.c; + }; + + module = { + name = extcmd; + common = commands/extcmd.c; + common = lib/arg.c; + }; + + module = { + name = fixvideo; + x86_efi = commands/efi/fixvideo.c; + enable = x86_efi; + }; + + module = { + name = gptsync; + common = commands/gptsync.c; + }; + + module = { + name = halt; + nopc = commands/halt.c; + i386_pc = commands/i386/pc/halt.c; + }; + + module = { + name = hashsum; + common = commands/hashsum.c; + }; + + module = { + name = hdparm; + common = commands/hdparm.c; + common = lib/hexdump.c; + enable = i386_pc; + }; + + module = { + name = help; + common = commands/help.c; + }; + + module = { + name = hexdump; + common = commands/hexdump.c; + common = lib/hexdump.c; + }; + + module = { + name = keystatus; + common = commands/keystatus.c; + }; + + module = { + name = loadbios; + x86_efi = commands/efi/loadbios.c; + enable = x86_efi; + }; + + module = { + name = loadenv; + common = commands/loadenv.c; + common = lib/envblk.c; + }; + + module = { + name = ls; + common = commands/ls.c; + }; + + module = { + name = lsmmap; + common = commands/lsmmap.c; + }; + + module = { + name = lspci; + common = commands/lspci.c; + + enable = x86; + enable = mips; + }; + + module = { + name = memrw; + common = commands/memrw.c; + }; + + module = { + name = minicmd; + common = commands/minicmd.c; + }; + + module = { + name = parttool; + common = commands/parttool.c; + }; + + module = { + name = password; + common = commands/password.c; + }; + + module = { + name = password_pbkdf2; + common = commands/password_pbkdf2.c; + }; + + module = { + name = play; + x86 = commands/i386/pc/play.c; + enable = x86; + }; + + module = { + name = probe; + common = commands/probe.c; + }; + + module = { + name = pxecmd; + i386_pc = commands/i386/pc/pxecmd.c; + enable = i386_pc; + }; + + module = { + name = read; + common = commands/read.c; + }; + + module = { + name = reboot; + common = commands/reboot.c; + }; + + module = { + name = search; + common = commands/search_wrap.c; + extra_dist = commands/search.c; + }; + + module = { + name = search_fs_file; + common = commands/search_file.c; + }; + + module = { + name = search_fs_uuid; + common = commands/search_uuid.c; + }; + + module = { + name = search_label; + common = commands/search_label.c; + }; + + module = { + name = setpci; + common = commands/setpci.c; + enable = x86; + }; + + module = { + name = sleep; + common = commands/sleep.c; + }; + + module = { + name = suspend; + ieee1275 = commands/ieee1275/suspend.c; + enable = i386_ieee1275; + enable = powerpc_ieee1275; + }; + + module = { + name = terminal; + common = commands/terminal.c; + }; + + module = { + name = test; + common = commands/test.c; + }; + + module = { + name = true; + common = commands/true.c; + }; + + module = { + name = usbtest; + common = commands/usbtest.c; + enable = i386_pc; + enable = mips_yeeloong; + enable = emu; + emu_condition = COND_GRUB_EMU_USB; + }; + + module = { + name = vbeinfo; + i386_pc = commands/i386/pc/vbeinfo.c; + enable = i386_pc; + }; + + module = { + name = vbetest; + i386_pc = commands/i386/pc/vbetest.c; + enable = i386_pc; + }; + + module = { + name = videotest; + common = commands/videotest.c; + }; + + module = { + name = xnu_uuid; + common = commands/xnu_uuid.c; + }; + + module = { + name = dm_nv; + common = disk/dmraid_nvidia.c; + }; + + module = { + name = loopback; + common = disk/loopback.c; + }; + + module = { + name = lvm; + common = disk/lvm.c; + }; + + module = { + name = mdraid; + common = disk/mdraid_linux.c; + }; + + module = { + name = raid; + common = disk/raid.c; + }; + + module = { + name = raid5rec; + common = disk/raid5_recover.c; + }; + + module = { + name = raid6rec; + common = disk/raid6_recover.c; + }; + + module = { + name = scsi; + common = disk/scsi.c; + }; + + module = { + name = memdisk; + common = disk/memdisk.c; + }; + + module = { + name = ata; + common = disk/ata.c; + enable = x86; + enable = mips; + }; + + module = { + name = ata_pthru; + common = disk/ata_pthru.c; + enable = x86; + enable = mips_yeeloong; + }; + + module = { + name = biosdisk; + i386_pc = disk/i386/pc/biosdisk.c; + enable = i386_pc; + }; + + module = { + name = usbms; + common = disk/usbms.c; + enable = i386_pc; + enable = mips_yeeloong; + enable = emu; + emu_condition = COND_GRUB_EMU_USB; + }; + + module = { + name = nand; + ieee1275 = disk/ieee1275/nand.c; + enable = i386_ieee1275; + }; + + module = { + name = efiemu; + i386_pc = efiemu/main.c; + i386_pc = efiemu/i386/loadcore32.c; + i386_pc = efiemu/i386/loadcore64.c; + i386_pc = efiemu/i386/pc/cfgtables.c; + i386_pc = efiemu/mm.c; + i386_pc = efiemu/loadcore_common.c; + i386_pc = efiemu/symbols.c; + i386_pc = efiemu/loadcore32.c; + i386_pc = efiemu/loadcore64.c; + i386_pc = efiemu/prepare32.c; + i386_pc = efiemu/prepare64.c; + i386_pc = efiemu/pnvram.c; + i386_pc = efiemu/i386/coredetect.c; + + extra_dist = efiemu/prepare.c; + extra_dist = efiemu/loadcore.c; + extra_dist = efiemu/runtime/efiemu.S; + extra_dist = efiemu/runtime/efiemu.c; + + enable = i386_pc; + }; + + module = { + name = font; + common = font/font.c; + common = font/font_cmd.c; + enable = emu; + enable = x86; + enable = sparc64; + enable = powerpc; + }; + + module = { + name = affs; + common = fs/affs.c; + }; + + module = { + name = afs; + common = fs/afs.c; + }; + + module = { + name = afs_be; + common = fs/afs_be.c; + }; + + module = { + name = befs; + common = fs/befs.c; + }; + + module = { + name = befs_be; + common = fs/befs_be.c; + }; + + module = { + name = cpio; + common = fs/cpio.c; + }; + + module = { + name = ext2; + common = fs/ext2.c; + }; + + module = { + name = fat; + common = fs/fat.c; + }; + + module = { + name = fshelp; + common = fs/fshelp.c; + }; + + module = { + name = hfs; + common = fs/hfs.c; + }; + + module = { + name = hfsplus; + common = fs/hfsplus.c; + }; + + module = { + name = iso9660; + common = fs/iso9660.c; + }; + + module = { + name = jfs; + common = fs/jfs.c; + }; + + module = { + name = minix; + common = fs/minix.c; + }; + + module = { + name = nilfs2; + common = fs/nilfs2.c; + }; + + module = { + name = ntfs; + common = fs/ntfs.c; + }; + + module = { + name = ntfscomp; + common = fs/ntfscomp.c; + }; + + module = { + name = reiserfs; + common = fs/reiserfs.c; + }; + + module = { + name = sfs; + common = fs/sfs.c; + }; + + module = { + name = tar; + common = fs/tar.c; + }; + + module = { + name = udf; + common = fs/udf.c; + }; + + module = { + name = ufs1; + common = fs/ufs.c; + }; + + module = { + name = ufs2; + common = fs/ufs2.c; + }; + + module = { + name = xfs; + common = fs/xfs.c; + }; + + module = { + name = pxe; + i386_pc = fs/i386/pc/pxe.c; + enable = i386_pc; + }; + + module = { + name = gettext; + common = gettext/gettext.c; + }; + + module = { + name = gfxmenu; + common = gfxmenu/gfxmenu.c; + common = gfxmenu/model.c; + common = gfxmenu/view.c; + common = gfxmenu/font.c; + common = gfxmenu/icon_manager.c; + common = gfxmenu/theme_loader.c; + common = gfxmenu/widget-box.c; + common = gfxmenu/gui_canvas.c; + common = gfxmenu/gui_circular_progress.c; + common = gfxmenu/gui_box.c; + common = gfxmenu/gui_label.c; + common = gfxmenu/gui_list.c; + common = gfxmenu/gui_image.c; + common = gfxmenu/gui_progress_bar.c; + common = gfxmenu/gui_util.c; + common = gfxmenu/gui_string_util.c; + common = gfxmenu/named_colors.c; + }; + + module = { + name = hello; + common = hello/hello.c; + }; + + module = { + name = gzio; + common = io/gzio.c; + }; + + module = { + name = bufio; + common = io/bufio.c; + enable = emu; + enable = x86; + enable = sparc64; + enable = powerpc; + }; + + module = { + name = elf; + common = kern/elf.c; + }; + + module = { + name = crypto; + common = lib/crypto.c; + + extra_dist = lib/libgcrypt-grub/cipher/crypto.lst; + }; + + module = { + name = pbkdf2; + common = lib/pbkdf2.c; + }; + + module = { + name = relocator; + mips = lib/mips/relocator.c; + mips = lib/mips/relocator_asm.S; + x86 = lib/i386/relocator.c; + x86 = lib/i386/relocator_asm.S; + x86 = lib/i386/relocator_backward.S; + extra_dist = lib/relocator.c; + enable = mips; + enable = x86; + }; + + module = { + name = datetime; + x86_noefi_mips = lib/cmos_datetime.c; + x86_efi = lib/efi/datetime.c; + sparc64_ieee1275 = lib/ieee1275/datetime.c; + powerpc_ieee1275 = lib/ieee1275/datetime.c; + enable = x86; + enable = mips; + enable = sparc64_ieee1275; + enable = powerpc_ieee1275; + }; + + module = { + name = setjmp; + common = lib/setjmp.S; + extra_dist = lib/i386/setjmp.S; + extra_dist = lib/mips/setjmp.S; + extra_dist = lib/x86_64/setjmp.S; + extra_dist = lib/sparc64/setjmp.S; + extra_dist = lib/powerpc/setjmp.S; + }; + + module = { + name = aout; + common = loader/aout.c; + enable = i386_pc; + enable = i386_qemu; + enable = i386_coreboot; + enable = i386_multiboot; + enable = i386_ieee1275; + }; + + module = { + name = bsd; + i386 = loader/i386/bsd.c; + i386 = loader/i386/bsd32.c; + i386 = loader/i386/bsd64.c; + i386 = loader/i386/bsd_helper.S; + i386 = loader/i386/bsd_trampoline.S; + + extra_dist = loader/i386/bsdXX.c; + extra_dist = loader/i386/bsd_pagetable.c; + + enable = i386_pc; + enable = i386_qemu; + enable = i386_coreboot; + enable = i386_multiboot; + }; + + module = { + name = linux16; + i386_pc = loader/i386/pc/linux.c; + enable = i386_pc; + }; + + module = { + name = multiboot2; + cppflags = "-DGRUB_USE_MULTIBOOT2"; + + common = loader/multiboot.c; + common = loader/multiboot_mbi2.c; + enable = x86; + enable = mips; + }; + + module = { + name = multiboot; + common = loader/multiboot.c; + x86 = loader/i386/multiboot_mbi.c; + extra_dist = loader/multiboot_elfxx.c; + enable = x86; + }; + + module = { + name = linux; + i386_noefi_noieee1275 = loader/i386/linux.c; + + x86_efi = loader/i386/efi/linux.c; + x86_64_efi = loader/i386/linux_trampoline.S; + i386_ieee1275 = loader/i386/ieee1275/linux.c; + mips = loader/mips/linux.c; + powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c; + sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c; + enable = noemu; + }; + + module = { + name = xnu; + x86_efi_pc = loader/xnu_resume.c; + x86_efi_pc = loader/i386/xnu.c; + x86_efi_pc = loader/macho32.c; + x86_efi_pc = loader/macho64.c; + x86_efi_pc = loader/macho.c; + x86_efi_pc = loader/xnu.c; + + extra_dist = loader/machoXX.c; + enable = i386_pc; + enable = x86_efi; + }; + + module = { + name = appleldr; + x86_efi = loader/efi/appleloader.c; + enable = x86_efi; + }; + + module = { + name = chain; + x86_efi = loader/efi/chainloader.c; + i386_pc = loader/i386/pc/chainloader.c; + enable = i386_pc; + enable = x86_efi; + }; + + module = { + name = mmap; + i386_pc = mmap/mmap.c; + i386_pc = mmap/i386/uppermem.c; + i386_pc = mmap/i386/mmap.c; + i386_pc = mmap/i386/pc/mmap.c; + i386_pc = mmap/i386/pc/mmap_helper.S; + + x86_efi = mmap/mmap.c; + x86_efi = mmap/i386/uppermem.c; + x86_efi = mmap/i386/mmap.c; + x86_efi = mmap/efi/mmap.c; + + i386_coreboot = mmap/mmap.c; + i386_coreboot = mmap/i386/uppermem.c; + i386_coreboot = mmap/i386/mmap.c; + + i386_multiboot = mmap/mmap.c; + i386_multiboot = mmap/i386/uppermem.c; + i386_multiboot = mmap/i386/mmap.c; + + i386_qemu = mmap/mmap.c; + i386_qemu = mmap/i386/uppermem.c; + i386_qemu = mmap/i386/mmap.c; + + i386_ieee1275 = mmap/mmap.c; + i386_ieee1275 = mmap/i386/uppermem.c; + i386_ieee1275 = mmap/i386/mmap.c; + + mips_yeeloong = mmap/mmap.c; + mips_yeeloong = mmap/mips/yeeloong/uppermem.c; + + enable = x86; + enable = mips_yeeloong; + }; + + module = { + name = normal; + common = normal/main.c; + common = normal/cmdline.c; + common = normal/dyncmd.c; + common = normal/auth.c; + common = normal/autofs.c; + common = normal/color.c; + common = normal/completion.c; + common = normal/datetime.c; + common = normal/menu.c; + common = normal/menu_entry.c; + common = normal/menu_text.c; + common = normal/misc.c; + common = normal/crypto.c; + common = normal/term.c; + common = normal/context.c; + common = normal/charset.c; + + common = script/main.c; + common = script/script.c; + common = script/execute.c; + common = script/function.c; + common = script/lexer.c; + common = script/argv.c; + + common = unidata.c; + common_nodist = grub_script.tab.c; + common_nodist = grub_script.yy.c; + common_nodist = grub_script.tab.h; + common_nodist = grub_script.yy.h; + + extra_dist = script/yylex.l; + extra_dist = script/parser.y; + + cflags = '$(CFLAGS_POSIX) -Wno-error'; + cppflags = '$(CPPFLAGS_POSIX)'; + }; + + module = { + name = part_acorn; + common = partmap/acorn.c; + }; + + module = { + name = part_amiga; + common = partmap/amiga.c; + }; + + module = { + name = part_apple; + common = partmap/apple.c; + }; + + module = { + name = part_gpt; + common = partmap/gpt.c; + }; + + module = { + name = part_msdos; + common = partmap/msdos.c; + }; + + module = { + name = part_sun; + common = partmap/sun.c; + }; + + module = { + name = part_bsd; + common = partmap/bsdlabel.c; + }; + + module = { + name = part_sunpc; + common = partmap/sunpc.c; + }; + + module = { + name = msdospart; + common = parttool/msdospart.c; + }; + + module = { + name = at_keyboard; + common = term/at_keyboard.c; + enable = x86; + }; + + module = { + name = gfxterm; + common = term/gfxterm.c; + enable = emu; + enable = x86; + enable = sparc64; + enable = powerpc; + }; + + module = { + name = serial; + common = term/serial.c; + x86 = term/ns8250.c; + + enable = emu; + enable = i386; + enable = x86_64_efi; + emu_condition = COND_GRUB_EMU_USB; + }; + + module = { + name = sendkey; + i386_pc = commands/i386/pc/sendkey.c; + enable = i386_pc; + }; + + module = { + name = terminfo; + common = term/terminfo.c; + common = term/tparm.c; + }; + + module = { + name = usb_keyboard; + common = term/usb_keyboard.c; + enable = i386_pc; + enable = mips_yeeloong; + }; + + module = { + name = vga; + i386_pc = video/i386/pc/vga.c; + enable = i386_pc; + }; + + module = { + name = vga_text; + x86 = term/i386/pc/vga_text.c; + x86 = term/i386/vga_common.c; + enable = x86; + }; + + module = { + name = video_cirrus; + x86 = video/cirrus.c; + enable = x86; + }; + + module = { + name = video_bochs; + x86 = video/bochs.c; + enable = x86; + }; + + module = { + name = functional_test; + common = tests/lib/functional_test.c; + common = tests/lib/test.c; + }; + + module = { + name = example_functional_test; + common = tests/example_functional_test.c; + cflags = -Wno-format; + }; + + module = { + name = bitmap; + common = video/bitmap.c; + enable = emu; + enable = x86; + enable = sparc64; + enable = powerpc; + }; + + module = { + name = bitmap_scale; + common = video/bitmap_scale.c; + enable = emu; + enable = x86; + enable = sparc64; + enable = powerpc; + }; + + module = { + name = efi_gop; + x86_efi = video/efi_gop.c; + enable = x86_efi; + }; + + module = { + name = efi_uga; + x86_efi = video/efi_uga.c; + enable = x86_efi; + }; + + module = { + name = jpeg; + common = video/readers/jpeg.c; + }; + + module = { + name = png; + common = video/readers/png.c; + }; + + module = { + name = tga; + common = video/readers/tga.c; + }; + + module = { + name = vbe; + i386_pc = video/i386/pc/vbe.c; + enable = i386_pc; + }; + + module = { + name = video_fb; + common = video/fb/video_fb.c; + common = video/fb/fbblit.c; + common = video/fb/fbfill.c; + common = video/fb/fbutil.c; + enable = emu; + enable = x86; + enable = sparc64; + enable = powerpc; + }; + + module = { + name = video; + common = video/video.c; + enable = emu; + enable = x86; + enable = sparc64; + enable = powerpc; + }; + + module = { + name = ieee1275_fb; + ieee1275 = video/ieee1275.c; + enable = powerpc; + enable = sparc64; + }; + + module = { + name = sdl; + emu = video/emu/sdl.c; + enable = emu; + condition = COND_GRUB_EMU_SDL; + }; + + module = { + name = datehook; + common = hook/datehook.c; + }; ++ ++module = { ++ name = test_blockarg; ++ common = tests/test_blockarg.c; ++}; diff --cc grub-core/commands/i386/pc/sendkey.c index 000000000,6c5602dec..1f506b3cd mode 000000,100644..100644 --- a/grub-core/commands/i386/pc/sendkey.c +++ b/grub-core/commands/i386/pc/sendkey.c @@@ -1,0 -1,384 +1,384 @@@ + /* sendkey.c - fake keystroke. */ + /* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2009 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + #include + #include + #include + #include + #include + #include + #include + #include + + static char sendkey[0x20]; + /* Length of sendkey. */ + static int keylen = 0; + static int noled = 0; + static const struct grub_arg_option options[] = + { + {"num", 'n', 0, "set numlock mode", "[on|off]", ARG_TYPE_STRING}, + {"caps", 'c', 0, "set capslock mode", "[on|off]", ARG_TYPE_STRING}, + {"scroll", 's', 0, "set scrolllock mode", "[on|off]", ARG_TYPE_STRING}, + {"insert", 0, 0, "set insert mode", "[on|off]", ARG_TYPE_STRING}, + {"pause", 0, 0, "set pause mode", "[on|off]", ARG_TYPE_STRING}, + {"left-shift", 0, 0, "press left shift", "[on|off]", ARG_TYPE_STRING}, + {"right-shift", 0, 0, "press right shift", "[on|off]", ARG_TYPE_STRING}, + {"sysrq", 0, 0, "press SysRq", "[on|off]", ARG_TYPE_STRING}, + {"numkey", 0, 0, "press NumLock key", "[on|off]", ARG_TYPE_STRING}, + {"capskey", 0, 0, "press CapsLock key", "[on|off]", ARG_TYPE_STRING}, + {"scrollkey", 0, 0, "press ScrollLock key", "[on|off]", ARG_TYPE_STRING}, + {"insertkey", 0, 0, "press Insert key", "[on|off]", ARG_TYPE_STRING}, + {"left-alt", 0, 0, "press left alt", "[on|off]", ARG_TYPE_STRING}, + {"right-alt", 0, 0, "press right alt", "[on|off]", ARG_TYPE_STRING}, + {"left-ctrl", 0, 0, "press left ctrl", "[on|off]", ARG_TYPE_STRING}, + {"right-ctrl", 0, 0, "press right ctrl", "[on|off]", ARG_TYPE_STRING}, + {"no-led", 0, 0, "don't update LED state", 0, 0}, + {0, 0, 0, 0, 0, 0} + }; + static int simple_flag_offsets[] + = {5, 6, 4, 7, 11, 1, 0, 10, 13, 14, 12, 15, 9, 3, 8, 2}; + + static grub_uint32_t andmask = 0xffffffff, ormask = 0; + + struct + keysym + { + char *unshifted_name; /* the name in unshifted state */ + char *shifted_name; /* the name in shifted state */ + unsigned char unshifted_ascii; /* the ascii code in unshifted state */ + unsigned char shifted_ascii; /* the ascii code in shifted state */ + unsigned char keycode; /* keyboard scancode */ + }; + + /* The table for key symbols. If the "shifted" member of an entry is + NULL, the entry does not have shifted state. Copied from GRUB Legacy setkey fuction */ + static struct keysym keysym_table[] = + { + {"escape", 0, 0x1b, 0, 0x01}, + {"1", "exclam", '1', '!', 0x02}, + {"2", "at", '2', '@', 0x03}, + {"3", "numbersign", '3', '#', 0x04}, + {"4", "dollar", '4', '$', 0x05}, + {"5", "percent", '5', '%', 0x06}, + {"6", "caret", '6', '^', 0x07}, + {"7", "ampersand", '7', '&', 0x08}, + {"8", "asterisk", '8', '*', 0x09}, + {"9", "parenleft", '9', '(', 0x0a}, + {"0", "parenright", '0', ')', 0x0b}, + {"minus", "underscore", '-', '_', 0x0c}, + {"equal", "plus", '=', '+', 0x0d}, + {"backspace", 0, '\b', 0, 0x0e}, + {"tab", 0, '\t', 0, 0x0f}, + {"q", "Q", 'q', 'Q', 0x10}, + {"w", "W", 'w', 'W', 0x11}, + {"e", "E", 'e', 'E', 0x12}, + {"r", "R", 'r', 'R', 0x13}, + {"t", "T", 't', 'T', 0x14}, + {"y", "Y", 'y', 'Y', 0x15}, + {"u", "U", 'u', 'U', 0x16}, + {"i", "I", 'i', 'I', 0x17}, + {"o", "O", 'o', 'O', 0x18}, + {"p", "P", 'p', 'P', 0x19}, + {"bracketleft", "braceleft", '[', '{', 0x1a}, + {"bracketright", "braceright", ']', '}', 0x1b}, + {"enter", 0, '\r', 0, 0x1c}, + {"control", 0, 0, 0, 0x1d}, + {"a", "A", 'a', 'A', 0x1e}, + {"s", "S", 's', 'S', 0x1f}, + {"d", "D", 'd', 'D', 0x20}, + {"f", "F", 'f', 'F', 0x21}, + {"g", "G", 'g', 'G', 0x22}, + {"h", "H", 'h', 'H', 0x23}, + {"j", "J", 'j', 'J', 0x24}, + {"k", "K", 'k', 'K', 0x25}, + {"l", "L", 'l', 'L', 0x26}, + {"semicolon", "colon", ';', ':', 0x27}, + {"quote", "doublequote", '\'', '"', 0x28}, + {"backquote", "tilde", '`', '~', 0x29}, + {"shift", 0, 0, 0, 0x2a}, + {"backslash", "bar", '\\', '|', 0x2b}, + {"z", "Z", 'z', 'Z', 0x2c}, + {"x", "X", 'x', 'X', 0x2d}, + {"c", "C", 'c', 'C', 0x2e}, + {"v", "V", 'v', 'V', 0x2f}, + {"b", "B", 'b', 'B', 0x30}, + {"n", "N", 'n', 'N', 0x31}, + {"m", "M", 'm', 'M', 0x32}, + {"comma", "less", ',', '<', 0x33}, + {"period", "greater", '.', '>', 0x34}, + {"slash", "question", '/', '?', 0x35}, + {"rshift", 0, 0, 0, 0x36}, + {"numasterisk", 0, '*', 0, 0x37}, + {"alt", 0, 0, 0, 0x38}, + {"space", 0, ' ', 0, 0x39}, + {"capslock", 0, 0, 0, 0x3a}, + {"F1", 0, 0, 0, 0x3b}, + {"F2", 0, 0, 0, 0x3c}, + {"F3", 0, 0, 0, 0x3d}, + {"F4", 0, 0, 0, 0x3e}, + {"F5", 0, 0, 0, 0x3f}, + {"F6", 0, 0, 0, 0x40}, + {"F7", 0, 0, 0, 0x41}, + {"F8", 0, 0, 0, 0x42}, + {"F9", 0, 0, 0, 0x43}, + {"F10", 0, 0, 0, 0x44}, + {"num7", "numhome", '7', 0, 0x47}, + {"num8", "numup", '8', 0, 0x48}, + {"num9", "numpgup", '9', 0, 0x49}, + {"numminus", 0, '-', 0, 0x4a}, + {"num4", "numleft", '4', 0, 0x4b}, + {"num5", "numcenter", '5', 0, 0x4c}, + {"num6", "numright", '6', 0, 0x4d}, + {"numplus", 0, '-', 0, 0x4e}, + {"num1", "numend", '1', 0, 0x4f}, + {"num2", "numdown", '2', 0, 0x50}, + {"num3", "numpgdown", '3', 0, 0x51}, + {"num0", "numinsert", '0', 0, 0x52}, + {"numperiod", "numdelete", 0, 0x7f, 0x53}, + {"F11", 0, 0, 0, 0x57}, + {"F12", 0, 0, 0, 0x58}, + {"numenter", 0, '\r', 0, 0xe0}, + {"numslash", 0, '/', 0, 0xe0}, + {"delete", 0, 0x7f, 0, 0xe0}, + {"insert", 0, 0xe0, 0, 0x52}, + {"home", 0, 0xe0, 0, 0x47}, + {"end", 0, 0xe0, 0, 0x4f}, + {"pgdown", 0, 0xe0, 0, 0x51}, + {"pgup", 0, 0xe0, 0, 0x49}, + {"down", 0, 0xe0, 0, 0x50}, + {"up", 0, 0xe0, 0, 0x48}, + {"left", 0, 0xe0, 0, 0x4b}, + {"right", 0, 0xe0, 0, 0x4d} + }; + + /* Set a simple flag in flags variable + OUTOFFSET - offset of flag in FLAGS, + OP - action id + */ + static void + grub_sendkey_set_simple_flag (int outoffset, int op) + { + if (op == 2) + { + andmask |= (1 << outoffset); + ormask &= ~(1 << outoffset); + } + else + { + andmask &= (~(1 << outoffset)); + if (op == 1) + ormask |= (1 << outoffset); + else + ormask &= ~(1 << outoffset); + } + } + + static int + grub_sendkey_parse_op (struct grub_arg_list state) + { + if (! state.set) + return 2; + + if (grub_strcmp (state.arg, "off") == 0 || grub_strcmp (state.arg, "0") == 0 + || grub_strcmp (state.arg, "unpress") == 0) + return 0; + + if (grub_strcmp (state.arg, "on") == 0 || grub_strcmp (state.arg, "1") == 0 + || grub_strcmp (state.arg, "press") == 0) + return 1; + + return 2; + } + + static grub_uint32_t oldflags; + + static grub_err_t + grub_sendkey_postboot (void) + { + /* For convention: pointer to flags. */ + grub_uint32_t *flags = (grub_uint32_t *) 0x417; + + *flags = oldflags; + + *((char *) 0x41a) = 0x1e; + *((char *) 0x41c) = 0x1e; + + return GRUB_ERR_NONE; + } + + /* Set keyboard buffer to our sendkey */ + static grub_err_t + grub_sendkey_preboot (int noret __attribute__ ((unused))) + { + /* For convention: pointer to flags. */ + grub_uint32_t *flags = (grub_uint32_t *) 0x417; + + oldflags = *flags; + + /* Set the sendkey. */ + *((char *) 0x41a) = 0x1e; + *((char *) 0x41c) = keylen + 0x1e; + grub_memcpy ((char *) 0x41e, sendkey, 0x20); + + /* Transform "any ctrl" to "right ctrl" flag. */ + if (*flags & (1 << 8)) + *flags &= ~(1 << 2); + + /* Transform "any alt" to "right alt" flag. */ + if (*flags & (1 << 9)) + *flags &= ~(1 << 3); + + *flags = (*flags & andmask) | ormask; + + /* Transform "right ctrl" to "any ctrl" flag. */ + if (*flags & (1 << 8)) + *flags |= (1 << 2); + + /* Transform "right alt" to "any alt" flag. */ + if (*flags & (1 << 9)) + *flags |= (1 << 3); + + /* Write new LED state */ + if (!noled) + { + int value = 0; + int failed; + /* Try 5 times */ + for (failed = 0; failed < 5; failed++) + { + value = 0; + /* Send command change LEDs */ + grub_outb (0xed, 0x60); + + /* Wait */ + do + value = grub_inb (0x60); + while ((value != 0xfa) && (value != 0xfe)); + + if (value == 0xfa) + { + /* Set new LEDs*/ + grub_outb ((*flags >> 4) & 7, 0x60); + break; + } + } + } + return GRUB_ERR_NONE; + } + + static grub_err_t -grub_cmd_sendkey (grub_extcmd_t cmd, int argc, char **args) ++grub_cmd_sendkey (grub_extcmd_context_t ctxt, int argc, char **args) + { - struct grub_arg_list *state = cmd->state; ++ struct grub_arg_list *state = ctxt->state; + + auto int find_key_code (char *key); + auto int find_ascii_code (char *key); + + int find_key_code (char *key) + { + unsigned i; + + for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++) + { + if (keysym_table[i].unshifted_name + && grub_strcmp (key, keysym_table[i].unshifted_name) == 0) + return keysym_table[i].keycode; + else if (keysym_table[i].shifted_name + && grub_strcmp (key, keysym_table[i].shifted_name) == 0) + return keysym_table[i].keycode; + } + + return 0; + } + + int find_ascii_code (char *key) + { + unsigned i; + + for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++) + { + if (keysym_table[i].unshifted_name + && grub_strcmp (key, keysym_table[i].unshifted_name) == 0) + return keysym_table[i].unshifted_ascii; + else if (keysym_table[i].shifted_name + && grub_strcmp (key, keysym_table[i].shifted_name) == 0) + return keysym_table[i].shifted_ascii; + } + + return 0; + } + + andmask = 0xffffffff; + ormask = 0; + + { + int i; + + keylen = 0; + + for (i = 0; i < argc && keylen < 0x20; i++) + { + int key_code; + + key_code = find_key_code (args[i]); + if (key_code) + { + sendkey[keylen++] = find_ascii_code (args[i]); + sendkey[keylen++] = key_code; + } + } + } + + { + unsigned i; + for (i = 0; i < sizeof (simple_flag_offsets) + / sizeof (simple_flag_offsets[0]); i++) + grub_sendkey_set_simple_flag (simple_flag_offsets[i], + grub_sendkey_parse_op(state[i])); + } + + /* Set noled. */ + noled = (state[sizeof (simple_flag_offsets) + / sizeof (simple_flag_offsets[0])].set); + + return GRUB_ERR_NONE; + } + + static grub_extcmd_t cmd; + static void *preboot_hook; + + GRUB_MOD_INIT (sendkey) + { + cmd = grub_register_extcmd ("sendkey", grub_cmd_sendkey, + GRUB_COMMAND_FLAG_BOTH, + "sendkey [KEYSTROKE1] [KEYSTROKE2] ...", + "Emulate a keystroke", options); + + preboot_hook + = grub_loader_register_preboot_hook (grub_sendkey_preboot, + grub_sendkey_postboot, + GRUB_LOADER_PREBOOT_HOOK_PRIO_CONSOLE); + } + + GRUB_MOD_FINI (sendkey) + { + grub_unregister_extcmd (cmd); + grub_loader_unregister_preboot_hook (preboot_hook); + } diff --cc grub-core/term/serial.c index 000000000,2268788af..394fc1576 mode 000000,100644..100644 --- a/grub-core/term/serial.c +++ b/grub-core/term/serial.c @@@ -1,0 -1,363 +1,363 @@@ + /* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + #define FOR_SERIAL_PORTS(var) FOR_LIST_ELEMENTS((var), (grub_serial_ports)) + + /* Argument options. */ + static const struct grub_arg_option options[] = + { + {"unit", 'u', 0, N_("Set the serial unit."), 0, ARG_TYPE_INT}, + {"port", 'p', 0, N_("Set the serial port address."), 0, ARG_TYPE_STRING}, + {"speed", 's', 0, N_("Set the serial port speed."), 0, ARG_TYPE_INT}, + {"word", 'w', 0, N_("Set the serial port word length."), 0, ARG_TYPE_INT}, + {"parity", 'r', 0, N_("Set the serial port parity."), 0, ARG_TYPE_STRING}, + {"stop", 't', 0, N_("Set the serial port stop bits."), 0, ARG_TYPE_INT}, + {0, 0, 0, 0, 0, 0} + }; + + struct grub_serial_port *grub_serial_ports; + + struct grub_serial_output_state + { + struct grub_terminfo_output_state tinfo; + struct grub_serial_port *port; + }; + + struct grub_serial_input_state + { + struct grub_terminfo_input_state tinfo; + struct grub_serial_port *port; + }; + + static grub_uint16_t + grub_serial_getwh (struct grub_term_output *term __attribute__ ((unused))) + { + const grub_uint8_t TEXT_WIDTH = 80; + const grub_uint8_t TEXT_HEIGHT = 24; + return (TEXT_WIDTH << 8) | TEXT_HEIGHT; + } + + static void + serial_put (grub_term_output_t term, const int c) + { + struct grub_serial_output_state *data = term->data; + data->port->driver->put (data->port, c); + } + + static int + serial_fetch (grub_term_input_t term) + { + struct grub_serial_input_state *data = term->data; + return data->port->driver->fetch (data->port); + } + + struct grub_serial_input_state grub_serial_terminfo_input = + { + .tinfo = + { + .readkey = serial_fetch + } + }; + + struct grub_serial_output_state grub_serial_terminfo_output = + { + .tinfo = + { + .put = serial_put + } + }; + + int registered = 0; + + static struct grub_term_input grub_serial_term_input = + { + .name = "serial", + .init = grub_terminfo_input_init, + .checkkey = grub_terminfo_checkkey, + .getkey = grub_terminfo_getkey, + .data = &grub_serial_terminfo_input + }; + + static struct grub_term_output grub_serial_term_output = + { + .name = "serial", + .putchar = grub_terminfo_putchar, + .getwh = grub_serial_getwh, + .getxy = grub_terminfo_getxy, + .gotoxy = grub_terminfo_gotoxy, + .cls = grub_terminfo_cls, + .setcolorstate = grub_terminfo_setcolorstate, + .setcursor = grub_terminfo_setcursor, + .flags = GRUB_TERM_CODE_TYPE_ASCII, + .data = &grub_serial_terminfo_output, + .normal_color = GRUB_TERM_DEFAULT_NORMAL_COLOR, + .highlight_color = GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR, + }; + + + + static struct grub_serial_port * + grub_serial_find (char *name) + { + struct grub_serial_port *port; + + FOR_SERIAL_PORTS (port) + if (grub_strcmp (port->name, name) == 0) + break; + + #ifndef GRUB_MACHINE_EMU + if (!port && grub_memcmp (name, "port", sizeof ("port") - 1) == 0 + && grub_isdigit (name [sizeof ("port") - 1])) + { + name = grub_serial_ns8250_add_port (grub_strtoul (&name[sizeof ("port") - 1], + 0, 16)); + if (!name) + return NULL; + + FOR_SERIAL_PORTS (port) + if (grub_strcmp (port->name, name) == 0) + break; + } + #endif + + return port; + } + + static grub_err_t -grub_cmd_serial (grub_extcmd_t cmd, int argc, char **args) ++grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args) + { - struct grub_arg_list *state = cmd->state; ++ struct grub_arg_list *state = ctxt->state; + char pname[40]; + char *name = NULL; + struct grub_serial_port *port; + struct grub_serial_config config; + grub_err_t err; + + if (state[0].set) + { + grub_snprintf (pname, sizeof (pname), "com%ld", + grub_strtoul (state[0].arg, 0, 0)); + name = pname; + } + + if (state[1].set) + { + grub_snprintf (pname, sizeof (pname), "port%lx", + grub_strtoul (state[1].arg, 0, 0)); + name = pname; + } + + if (argc >= 1) + name = args[0]; + + if (!name) + name = "com0"; + + port = grub_serial_find (name); + if (!port) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown serial port"); + + config = port->config; + + if (state[2].set) + config.speed = grub_strtoul (state[2].arg, 0, 0); + + if (state[3].set) + config.word_len = grub_strtoul (state[3].arg, 0, 0); + + if (state[4].set) + { + if (! grub_strcmp (state[4].arg, "no")) + config.parity = GRUB_SERIAL_PARITY_NONE; + else if (! grub_strcmp (state[4].arg, "odd")) + config.parity = GRUB_SERIAL_PARITY_ODD; + else if (! grub_strcmp (state[4].arg, "even")) + config.parity = GRUB_SERIAL_PARITY_EVEN; + else + return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad parity"); + } + + if (state[5].set) + { + if (! grub_strcmp (state[5].arg, "1")) + config.stop_bits = GRUB_SERIAL_STOP_BITS_1; + else if (! grub_strcmp (state[5].arg, "2")) + config.stop_bits = GRUB_SERIAL_STOP_BITS_2; + else + return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad number of stop bits"); + } + + /* Initialize with new settings. */ + err = port->driver->configure (port, &config); + if (err) + return err; + #ifndef GRUB_MACHINE_EMU + /* Compatibility kludge. */ + if (port->driver == &grub_ns8250_driver) + { + if (!registered) + { + grub_term_register_input ("serial", &grub_serial_term_input); + grub_term_register_output ("serial", &grub_serial_term_output); + } + grub_serial_terminfo_output.port = port; + grub_serial_terminfo_input.port = port; + registered = 1; + } + #endif + return GRUB_ERR_NONE; + } + + grub_err_t + grub_serial_register (struct grub_serial_port *port) + { + struct grub_term_input *in; + struct grub_term_output *out; + struct grub_serial_input_state *indata; + struct grub_serial_output_state *outdata; + + in = grub_malloc (sizeof (*in)); + if (!in) + return grub_errno; + + indata = grub_malloc (sizeof (*indata)); + if (!indata) + { + grub_free (in); + return grub_errno; + } + + grub_memcpy (in, &grub_serial_term_input, sizeof (*in)); + in->data = indata; + in->name = grub_xasprintf ("serial_%s", port->name); + grub_memcpy (indata, &grub_serial_terminfo_input, sizeof (*indata)); + + if (!in->name) + { + grub_free (in); + grub_free (indata); + return grub_errno; + } + + out = grub_malloc (sizeof (*out)); + if (!out) + { + grub_free (in); + grub_free (indata); + grub_free ((char *) in->name); + return grub_errno; + } + + outdata = grub_malloc (sizeof (*outdata)); + if (!outdata) + { + grub_free (in); + grub_free (indata); + grub_free ((char *) in->name); + grub_free (out); + return grub_errno; + } + + grub_memcpy (out, &grub_serial_term_output, sizeof (*out)); + out->data = outdata; + out->name = in->name; + grub_memcpy (outdata, &grub_serial_terminfo_output, sizeof (*outdata)); + + grub_list_push (GRUB_AS_LIST_P (&grub_serial_ports), GRUB_AS_LIST (port)); + ((struct grub_serial_input_state *) in->data)->port = port; + ((struct grub_serial_output_state *) out->data)->port = port; + port->term_in = in; + port->term_out = out; + grub_terminfo_output_register (out, "vt100"); + #ifdef GRUB_MACHINE_MIPS_YEELOONG + if (grub_strcmp (port->name, "com0") == 0) + { + grub_term_register_input_active ("serial_*", in); + grub_term_register_output_active ("serial_*", out); + } + else + #endif + { + grub_term_register_input ("serial_*", in); + grub_term_register_output ("serial_*", out); + } + + return GRUB_ERR_NONE; + } + + void + grub_serial_unregister (struct grub_serial_port *port) + { + if (port->driver->fini) + port->driver->fini (port); + + if (port->term_in) + grub_term_unregister_input (port->term_in); + if (port->term_out) + grub_term_unregister_output (port->term_out); + + grub_list_remove (GRUB_AS_LIST_P (&grub_serial_ports), GRUB_AS_LIST (port)); + } + + void + grub_serial_unregister_driver (struct grub_serial_driver *driver) + { + struct grub_serial_port *port, *next; + for (port = grub_serial_ports; port; port = next) + { + next = port->next; + if (port->driver == driver) + grub_serial_unregister (port); + } + } + + static grub_extcmd_t cmd; + + GRUB_MOD_INIT(serial) + { + cmd = grub_register_extcmd ("serial", grub_cmd_serial, + GRUB_COMMAND_FLAG_BOTH, + N_("[OPTIONS...]"), + N_("Configure serial port."), options); + #ifndef GRUB_MACHINE_EMU + grub_ns8250_init (); + #endif + } + + GRUB_MOD_FINI(serial) + { + while (grub_serial_ports) + grub_serial_unregister (grub_serial_ports); + if (registered) + { + grub_term_unregister_input (&grub_serial_term_input); + grub_term_unregister_output (&grub_serial_term_output); + } + grub_unregister_extcmd (cmd); + } diff --cc grub-core/tests/test_blockarg.c index bb6f3c3f0,000000000..bb6f3c3f0 mode 100644,000000..100644 --- a/grub-core/tests/test_blockarg.c +++ b/grub-core/tests/test_blockarg.c