Import grub2_2.02~beta3.orig.tar.xz

This commit is contained in:
Colin Watson 2016-09-18 17:40:00 +01:00
commit 422889f919
681 changed files with 516921 additions and 59595 deletions

241
.gitignore vendored
View File

@ -1,241 +0,0 @@
00_header
10_*
20_linux_xen
30_os-prober
40_custom
41_custom
*.1
*.8
aclocal.m4
ahci_test
ascii.bitmaps
ascii.h
autom4te.cache
build-grub-gen-asciih
build-grub-gen-widthspec
build-grub-mkfont
cdboot_test
cmp_test
config.cache
config.guess
config.h
config-util.h
config-util.h.in
config.log
config.status
config.sub
configure
core_compress_test
DISTLIST
docs/*.info
docs/stamp-vti
docs/version.texi
ehci_test
example_grub_script_test
example_scripted_test
example_unit_test
*.exec
*.exec.exe
fddboot_test
genkernsyms.sh
gensymlist.sh
gentrigtables
gentrigtables.exe
gettext_strings_test
grub-bin2h
/grub-bios-setup
/grub-bios-setup.exe
grub_cmd_date
grub_cmd_echo
grub_cmd_regexp
grub_cmd_set_date
grub_cmd_sleep
/grub-editenv
/grub-editenv.exe
grub-emu
grub-emu-lite
grub-emu.exe
grub-emu-lite.exe
grub_emu_init.c
grub_emu_init.h
grub-fstest
grub-fstest.exe
grub_fstest_init.c
grub_fstest_init.h
grub_func_test
grub-install
grub-install.exe
grub-kbdcomp
grub-macho2img
/grub-menulst2cfg
/grub-menulst2cfg.exe
/grub-mk*
grub-mount
/grub-ofpathname
/grub-ofpathname.exe
grub-core/build-grub-pe2elf.exe
/grub-probe
/grub-probe.exe
grub_probe_init.c
grub_probe_init.h
/grub-reboot
grub_script_blanklines
grub_script_blockarg
grub_script_break
grub-script-check
grub-script-check.exe
grub_script_check_init.c
grub_script_check_init.h
grub_script_comments
grub_script_continue
grub_script_dollar
grub_script_echo1
grub_script_echo_keywords
grub_script_escape_comma
grub_script_eval
grub_script_expansion
grub_script_final_semicolon
grub_script_for1
grub_script_functions
grub_script_gettext
grub_script_if
grub_script_leading_whitespace
grub_script_no_commands
grub_script_not
grub_script_return
grub_script_setparams
grub_script_shift
grub_script_strcmp
grub_script_test
grub_script_vars1
grub_script_while1
grub_script.tab.c
grub_script.tab.h
grub_script.yy.c
grub_script.yy.h
grub-set-default
grub_setup_init.c
grub_setup_init.h
grub-shell
grub-shell-tester
grub-sparc64-setup
grub-sparc64-setup.exe
gzcompress_test
hddboot_test
help_test
*.img
*.image
*.image.exe
include/grub/cpu
include/grub/machine
install-sh
lib/libgcrypt-grub
libgrub_a_init.c
*.log
*.lst
lzocompress_test
*.marker
Makefile
*.mod
mod-*.c
missing
netboot_test
*.o
*.a
ohci_test
partmap_test
pata_test
*.pf2
*.pp
po/*.mo
po/grub.pot
po/POTFILES
po/stamp-po
printf_test
priority_queue_unit_test
pseries_test
stamp-h
stamp-h1
stamp-h.in
symlist.c
symlist.h
trigtables.c
*.trs
uhci_test
update-grub_lib
unidata.c
xzcompress_test
Makefile.in
GPATH
GRTAGS
GSYMS
GTAGS
compile
depcomp
mdate-sh
texinfo.tex
grub-core/lib/libgcrypt-grub
.deps
.deps-util
.deps-core
.dirstamp
Makefile.util.am
contrib
grub-core/bootinfo.txt
grub-core/Makefile.core.am
grub-core/Makefile.gcry.def
grub-core/contrib
grub-core/gdb_grub
grub-core/genmod.sh
grub-core/gensyminfo.sh
grub-core/gmodule.pl
grub-core/grub.chrp
grub-core/modinfo.sh
grub-core/*.module
grub-core/*.module.exe
grub-core/*.pp
util/bash-completion.d/grub
grub-core/gnulib/alloca.h
grub-core/gnulib/arg-nonnull.h
grub-core/gnulib/c++defs.h
grub-core/gnulib/charset.alias
grub-core/gnulib/configmake.h
grub-core/gnulib/float.h
grub-core/gnulib/getopt.h
grub-core/gnulib/langinfo.h
grub-core/gnulib/ref-add.sed
grub-core/gnulib/ref-del.sed
grub-core/gnulib/stdio.h
grub-core/gnulib/stdlib.h
grub-core/gnulib/string.h
grub-core/gnulib/strings.h
grub-core/gnulib/sys
grub-core/gnulib/unistd.h
grub-core/gnulib/warn-on-use.h
grub-core/gnulib/wchar.h
grub-core/gnulib/wctype.h
grub-core/rs_decoder.h
widthspec.bin
widthspec.h
docs/stamp-1
docs/version-dev.texi
Makefile.utilgcry.def
po/*.po
po/*.gmo
po/LINGUAS
po/remove-potcdate.sed
include/grub/gcrypt/gcrypt.h
include/grub/gcrypt/g10lib.h
po/POTFILES.in
po/POTFILES-shell.in
/grub-glue-efi
/grub-render-label
/grub-glue-efi.exe
/grub-render-label.exe
grub-core/gnulib/locale.h
grub-core/gnulib/unitypes.h
grub-core/gnulib/uniwidth.h
build-aux/test-driver
/garbage-gen
/garbage-gen.exe
/grub-fs-tester

55620
ChangeLog

File diff suppressed because it is too large Load Diff

55487
ChangeLog-2015 Normal file

File diff suppressed because it is too large Load Diff

29
INSTALL
View File

@ -13,6 +13,9 @@ configuring the GRUB.
* GCC 4.1.3 or later
Note: older versions may work but support is limited
Experimental support for clang 3.3 or later (results in much bigger binaries)
for i386, x86_64, arm (except thumb), arm64, mips(el), powerpc, sparc64
Note: clang 3.2 or later works for i386 and x86_64 targets but results in
much bigger binaries.
earlier versions not tested
@ -26,7 +29,8 @@ configuring the GRUB.
fail.
Note: clang 3.2 or later works for powerpc
earlier versions not tested
Note: clang doesn't support -mno-app-regs and so can't be used for sparc64
Note: clang 3.5 or later works for sparc64
earlier versions return "error: unable to interface with target machine"
Note: clang has no support for ia64 and hence you can't compile GRUB
for ia64 with clang
* GNU Make
@ -35,6 +39,7 @@ configuring the GRUB.
* GNU binutils 2.9.1.0.23 or later
* Flex 2.5.35 or later
* Other standard GNU/Unix tools
* a libc with large file support (e.g. glibc 2.1 or later)
On GNU/Linux, you also need:
@ -99,6 +104,9 @@ The simplest way to compile this package is:
3. Type `./autogen.sh'.
* autogen.sh uses python. By default invocation is "python" but can be
overriden by setting variable $PYTHON.
4. Type `./configure' to configure the package for your system.
If you're using `csh' on an old version of System V, you might
need to type `sh ./configure' instead to prevent `csh' from trying
@ -140,7 +148,7 @@ If build and host are different make check isn't available.
If build and host are different man pages are not generated.
As an example imagine you have a build system running on FreeBSD on sparc
which prepares packages for developpers running amd64 GNU/Linux laptop and
which prepares packages for developers running amd64 GNU/Linux laptop and
they need to make images for ARM board running U-boot. In this case:
build=sparc64-freebsd
@ -149,7 +157,7 @@ target=arm-uboot
For this example the configure line might look like (more details below)
(some options are optional and included here for completeness but some rarely
used options are omited):
used options are omitted):
./configure BUILD_CC=gcc BUILD_FREETYPE=freetype-config --host=amd64-linux-gnu
CC=amd64-linux-gnu-gcc CFLAGS="-g -O2" FREETYPE=amd64-linux-gnu-freetype-config
@ -168,14 +176,15 @@ corresponding platform are not needed for the platform in question.
generate sin and cos tables.
2. BUILD_CFLAGS= for C options for build.
3. BUILD_CPPFLAGS= for C preprocessor options for build.
4. BUILD_FREETYPE= for freetype-config for build (optional).
4. BUILD_LDFLAGS= for linker options for build.
5. BUILD_FREETYPE= for freetype-config for build (optional).
- For host
1. --host= to autoconf name of host.
2. CC= for gcc able to compile for host
3. CFLAGS= for C options for host.
4. CPPFLAGS= for C preprocessor options for host.
5. LDFLAGS= for linker options for host.
3. HOST_CFLAGS= for C options for host.
4. HOST_CPPFLAGS= for C preprocessor options for host.
5. HOST_LDFLAGS= for linker options for host.
6. FREETYPE= for freetype-config for host (optional).
7. Libdevmapper if any must be in standard linker folders (-ldevmapper) (optional).
8. Libfuse if any must be in standard linker folders (-lfuse) (optional).
@ -196,9 +205,9 @@ corresponding platform are not needed for the platform in question.
11. TARGET_RANLIB= for ranlib for target.
- Additionally for emu, for host and target.
1. SDL is looked for in stadard linker directories (-lSDL) (optional)
2. libpciaccess is looked for in stadard linker directories (-lpciaccess) (optional)
3. libusb is looked for in stadard linker directories (-lusb) (optional)
1. SDL is looked for in standard linker directories (-lSDL) (optional)
2. libpciaccess is looked for in standard linker directories (-lpciaccess) (optional)
3. libusb is looked for in standard linker directories (-lusb) (optional)
- Platform-agnostic tools and data.
1. make is the tool you execute after ./configure.

View File

@ -1,7 +1,11 @@
AUTOMAKE_OPTIONS = subdir-objects -Wno-portability
DEPDIR = .deps-util
SUBDIRS = grub-core/gnulib . grub-core po docs util/bash-completion.d
SUBDIRS = grub-core/gnulib .
if COND_real_platform
SUBDIRS += grub-core
endif
SUBDIRS += po docs util/bash-completion.d
include $(top_srcdir)/conf/Makefile.common
include $(top_srcdir)/conf/Makefile.extra-dist
@ -66,35 +70,40 @@ endif
starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0
build-grub-mkfont: util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
CLEANFILES += build-grub-mkfont
build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT)
garbage-gen: util/garbage-gen.c
$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $^
CLEANFILES += garbage-gen
garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c
$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $^
CLEANFILES += garbage-gen$(BUILD_EXEEXT)
EXTRA_DIST += util/garbage-gen.c
build-grub-gen-asciih: util/grub-gen-asciih.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
CLEANFILES += build-grub-gen-asciih
build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT)
build-grub-gen-widthspec: util/grub-gen-widthspec.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
CLEANFILES += build-grub-gen-widthspec
build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT)
if COND_STARFIELD
starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files)
dejavu_10.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont
./build-grub-mkfont -s 10 -o $@ $(DJVU_FONT_SOURCE)
dejavu_12.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont
./build-grub-mkfont -s 12 -o $@ $(DJVU_FONT_SOURCE)
dejavu_14.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont
./build-grub-mkfont -s 14 -o $@ $(DJVU_FONT_SOURCE)
dejavu_bold_14.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont
./build-grub-mkfont -b -s 14 -o $@ $(DJVU_FONT_SOURCE)
dejavu_16.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont
./build-grub-mkfont -s 16 -o $@ $(DJVU_FONT_SOURCE)
dejavu_10.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
./build-grub-mkfont$(BUILD_EXEEXT) -s 10 -o $@ $(DJVU_FONT_SOURCE)
CLEANFILES += dejavu_10.pf2
dejavu_12.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
./build-grub-mkfont$(BUILD_EXEEXT) -s 12 -o $@ $(DJVU_FONT_SOURCE)
CLEANFILES += dejavu_12.pf2
dejavu_14.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
./build-grub-mkfont$(BUILD_EXEEXT) -s 14 -o $@ $(DJVU_FONT_SOURCE)
CLEANFILES += dejavu_14.pf2
dejavu_bold_14.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
./build-grub-mkfont$(BUILD_EXEEXT) -b -s 14 -o $@ $(DJVU_FONT_SOURCE)
CLEANFILES += dejavu_bold_14.pf2
dejavu_16.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
./build-grub-mkfont$(BUILD_EXEEXT) -s 16 -o $@ $(DJVU_FONT_SOURCE)
CLEANFILES += dejavu_16.pf2
else
starfield_DATA =
endif
@ -102,28 +111,28 @@ endif
EXTRA_DIST += $(starfield_theme_files)
EXTRA_DIST += $(srcdir)/themes/starfield/src/slider_s.xcf $(srcdir)/themes/starfield/src/slider_n.xcf $(srcdir)/themes/starfield/src/slider_c.xcf $(srcdir)/themes/starfield/src/blob_nw.xcf $(srcdir)/themes/starfield/src/bootmenu/center.xcf $(srcdir)/themes/starfield/src/bootmenu/corner.xcf $(srcdir)/themes/starfield/src/bootmenu/side.xcf $(srcdir)/themes/starfield/src/terminalbox/side.xcf $(srcdir)/themes/starfield/src/terminalbox/corner.xcf $(srcdir)/themes/starfield/src/terminalbox/center.xcf
unicode.pf2: $(FONT_SOURCE) build-grub-mkfont
./build-grub-mkfont -o $@ $(FONT_SOURCE) || (rm -f $@; exit 1)
unicode.pf2: $(FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
./build-grub-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) || (rm -f $@; exit 1)
CLEANFILES += unicode.pf2
# Arrows and lines are needed to draw the menu, so always include them
UNICODE_ARROWS=0x2190-0x2193
UNICODE_LINES=0x2501-0x251B
ascii.pf2: $(FONT_SOURCE) build-grub-mkfont
./build-grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1)
ascii.pf2: $(FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
./build-grub-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1)
CLEANFILES += ascii.pf2
euro.pf2: $(FONT_SOURCE) build-grub-mkfont
./build-grub-mkfont -o $@ $(FONT_SOURCE) -r 0x0-0x4ff,0x1e00-0x1fff,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1)
euro.pf2: $(FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
./build-grub-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) -r 0x0-0x4ff,0x1e00-0x1fff,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1)
CLEANFILES += euro.pf2
ascii.h: $(FONT_SOURCE) build-grub-gen-asciih
./build-grub-gen-asciih $(FONT_SOURCE) $@ || (rm -f $@; exit 1)
ascii.h: $(FONT_SOURCE) build-grub-gen-asciih$(BUILD_EXEEXT)
./build-grub-gen-asciih$(BUILD_EXEEXT) $(FONT_SOURCE) $@ || (rm -f $@; exit 1)
CLEANFILES += ascii.h
widthspec.h: $(FONT_SOURCE) build-grub-gen-widthspec
./build-grub-gen-widthspec $(FONT_SOURCE) $@ || (rm -f $@; exit 1)
widthspec.h: $(FONT_SOURCE) build-grub-gen-widthspec$(BUILD_EXEEXT)
./build-grub-gen-widthspec$(BUILD_EXEEXT) $(FONT_SOURCE) $@ || (rm -f $@; exit 1)
CLEANFILES += widthspec.h
# Install config.h into platformdir
@ -132,6 +141,8 @@ nodist_platform_HEADERS = config.h
pkgdata_DATA += grub-mkconfig_lib
if COND_real_platform
if COND_i386_coreboot
QEMU32=qemu-system-i386
endif
@ -334,33 +345,35 @@ bootcheck-ntldr: ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg grub-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/ntldr.bin=ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
if COND_i386_efi
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386
# NetBSD has no support for finding ACPI on EFI
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386
endif
if COND_x86_64_efi
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386
# NetBSD has no support for finding ACPI on EFI
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386
endif
if COND_i386_multiboot
# FreeBSD requires ACPI
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64
# *BSD requires ACPI
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64
endif
if COND_i386_qemu
# *BSD requires ACPI
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64
endif
if COND_i386_coreboot
# Freebsd requires ACPI
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64
endif
if COND_i386_qemu
# FreeBSD requires ACPI
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386
endif
if COND_i386_pc
#pc chainloader by definition is only for i386-pc
#ntldr and bootmgr require BIOS.
#legacy protocol makes early BIOS calls.
# NetBSD crashes early on non-BIOS
#legacy protocol (linux16) makes early BIOS calls.
# 32-bit NetBSD crashes early on non-BIOS
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64 bootcheck-knetbsd-x86_64 bootcheck-kfreebsd-x86_64 bootcheck-kfreebsd-i386 bootcheck-pc-chainloader bootcheck-ntldr bootcheck-linux16-i386 bootcheck-linux16-x86_64 bootcheck-knetbsd-i386
endif
@ -383,12 +396,10 @@ if COND_powerpc_ieee1275
BOOTCHECKS = bootcheck-linux-ppc
endif
EXTRA_DIST += grub-core/tests/boot/kbsd.init-i386.S grub-core/tests/boot/kbsd.init-x86_64.S grub-core/tests/boot/kbsd.spec.txt grub-core/tests/boot/kernel-8086.S grub-core/tests/boot/kernel-i386.S grub-core/tests/boot/kfreebsd-aout.cfg grub-core/tests/boot/kfreebsd.cfg grub-core/tests/boot/kfreebsd.init-i386.S grub-core/tests/boot/kfreebsd.init-x86_64.S grub-core/tests/boot/knetbsd.cfg grub-core/tests/boot/kopenbsd.cfg grub-core/tests/boot/kopenbsdlabel.txt grub-core/tests/boot/linux16.cfg grub-core/tests/boot/linux.cfg grub-core/tests/boot/linux.init-i386.S grub-core/tests/boot/linux.init-mips.S grub-core/tests/boot/linux.init-ppc.S grub-core/tests/boot/linux.init-x86_64.S grub-core/tests/boot/linux-ppc.cfg grub-core/tests/boot/multiboot2.cfg grub-core/tests/boot/multiboot.cfg grub-core/tests/boot/ntldr.cfg grub-core/tests/boot/pc-chainloader.cfg grub-core/tests/boot/qemu-shutdown-x86.S
.PHONY: bootcheck-linux-i386 bootcheck-linux-x86_64 \
bootcheck-kfreebsd-i386 bootcheck-kfreebsd-x86_64 \
bootcheck-knetbsd-i386 bootcheck-knetbsd-x86_64 \
bootcheck-linux-mips
bootcheck-linux-mips FORCE
# Randomly generated
SUCCESSFUL_BOOT_STRING=3e49994fd5d82b7c9298d672d774080d
@ -398,10 +409,15 @@ BOOTCHECK_TIMEOUT=180
bootcheck: $(BOOTCHECKS)
if COND_i386_coreboot
default_payload.elf: grub-mkstandalone grub-mkimage
pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos xfs ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg
default_payload.elf: grub-mkstandalone grub-mkimage FORCE
test -f $@ && rm $@ || true
pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help syslinuxcfg xnu $(shell cat grub-core/fs.lst) password_pbkdf2 $(EXTRA_PAYLOAD_MODULES)' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg
endif
endif
EXTRA_DIST += grub-core/tests/boot/kbsd.init-i386.S grub-core/tests/boot/kbsd.init-x86_64.S grub-core/tests/boot/kbsd.spec.txt grub-core/tests/boot/kernel-8086.S grub-core/tests/boot/kernel-i386.S grub-core/tests/boot/kfreebsd-aout.cfg grub-core/tests/boot/kfreebsd.cfg grub-core/tests/boot/kfreebsd.init-i386.S grub-core/tests/boot/kfreebsd.init-x86_64.S grub-core/tests/boot/knetbsd.cfg grub-core/tests/boot/kopenbsd.cfg grub-core/tests/boot/kopenbsdlabel.txt grub-core/tests/boot/linux16.cfg grub-core/tests/boot/linux.cfg grub-core/tests/boot/linux.init-i386.S grub-core/tests/boot/linux.init-mips.S grub-core/tests/boot/linux.init-ppc.S grub-core/tests/boot/linux.init-x86_64.S grub-core/tests/boot/linux-ppc.cfg grub-core/tests/boot/multiboot2.cfg grub-core/tests/boot/multiboot.cfg grub-core/tests/boot/ntldr.cfg grub-core/tests/boot/pc-chainloader.cfg grub-core/tests/boot/qemu-shutdown-x86.S
windowsdir=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows
windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA)
test -d $(windowsdir) && rm -rf $(windowsdir) || true
@ -420,10 +436,33 @@ windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA)
for x in $(starfield_DATA); do \
cp -fp $$x $(windowsdir)/themes/starfield/$$(basename $$x); \
done
for x in $(GRUB_WINDOWS_EXTRA_DIST); do \
cp -fp $$x $(windowsdir); \
done
windowszip=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows.zip
windowszip: windowsdir
test -f $(windowszip) && rm $(windowszip) || true
zip -r $(windowszip) $(windowsdir)
rm -rf $(windowsdir)
EXTRA_DIST += linguas.sh
changelog_start_date = 2015-01-23
gitlog_to_changelog = $(top_srcdir)/build-aux/gitlog-to-changelog
ChangeLog: FORCE
if test -d $(top_srcdir)/.git; then \
$(gitlog_to_changelog) --srcdir=$(top_srcdir) --since=$(changelog_start_date) > '$@.tmp'; \
rm -f '$@'; mv '$@.tmp' '$@'; \
else \
touch $@; \
fi
EXTRA_DIST += ChangeLog ChangeLog-2015
syslinux_test: $(top_builddir)/config.status tests/syslinux/ubuntu10.04_grub.cfg
tests/syslinux/ubuntu10.04_grub.cfg: $(top_builddir)/config.status tests/syslinux/ubuntu10.04_grub.cfg.in
(for x in tests/syslinux/ubuntu10.04_grub.cfg.in ; do cat $(srcdir)/"$$x"; done) | $(top_builddir)/config.status --file=$@:-
CLEANFILES += tests/syslinux/ubuntu10.04_grub.cfg

12942
Makefile.in Normal file

File diff suppressed because it is too large Load Diff

1586
Makefile.util.am Normal file

File diff suppressed because it is too large Load Diff

View File

@ -48,6 +48,7 @@ library = {
common = grub-core/partmap/gpt.c;
common = grub-core/partmap/msdos.c;
common = grub-core/fs/proc.c;
common = grub-core/fs/archelp.c;
};
library = {
@ -91,7 +92,6 @@ library = {
common = grub-core/fs/bfs.c;
common = grub-core/fs/btrfs.c;
common = grub-core/fs/cbfs.c;
common = grub-core/fs/archelp.c;
common = grub-core/fs/cpio.c;
common = grub-core/fs/cpio_be.c;
common = grub-core/fs/odc.c;
@ -172,6 +172,8 @@ program = {
common = util/grub-mkimage.c;
common = util/mkimage.c;
common = util/grub-mkimage32.c;
common = util/grub-mkimage64.c;
common = util/resolve.c;
common = grub-core/kern/emu/argp_common.c;
common = grub-core/osdep/init.c;
@ -384,7 +386,7 @@ program = {
ldadd = libgrubgcry.a;
ldadd = libgrubkern.a;
ldadd = grub-core/gnulib/libgnu.a;
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBGEOM)';
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
};
program = {
@ -405,7 +407,7 @@ program = {
program = {
name = grub-macbless;
installdir = sbin;
mansection = 1;
mansection = 8;
common = util/grub-macbless.c;
common = grub-core/osdep/init.c;
common = grub-core/kern/emu/argp_common.c;
@ -510,6 +512,8 @@ program = {
common = util/render-label.c;
common = util/glue-efi.c;
common = util/mkimage.c;
common = util/grub-mkimage32.c;
common = util/grub-mkimage64.c;
common = util/grub-install-common.c;
common = util/setup_bios.c;
common = util/setup_sparc.c;
@ -552,6 +556,8 @@ program = {
common = util/render-label.c;
common = util/glue-efi.c;
common = util/mkimage.c;
common = util/grub-mkimage32.c;
common = util/grub-mkimage64.c;
common = util/grub-install-common.c;
common = util/setup_bios.c;
common = util/setup_sparc.c;
@ -595,6 +601,8 @@ program = {
common = util/grub-install.c;
common = util/probe.c;
common = util/mkimage.c;
common = util/grub-mkimage32.c;
common = util/grub-mkimage64.c;
common = util/grub-install-common.c;
common = util/setup_bios.c;
common = util/setup_sparc.c;
@ -613,7 +621,6 @@ program = {
common = grub-core/disk/host.c;
common = util/resolve.c;
enable = noemu;
common = grub-core/kern/emu/argp_common.c;
common = grub-core/osdep/init.c;
@ -633,6 +640,8 @@ program = {
common = util/grub-mknetdir.c;
common = util/mkimage.c;
common = util/grub-mkimage32.c;
common = util/grub-mkimage64.c;
common = util/grub-install-common.c;
common = util/setup_bios.c;
common = util/setup_sparc.c;
@ -708,7 +717,7 @@ script = {
name = grub-fs-tester;
common = tests/util/grub-fs-tester.in;
installdir = noinst;
dependencies = garbage-gen;
dependencies = 'garbage-gen$(BUILD_EXEEXT)';
};
script = {
@ -1150,6 +1159,24 @@ script = {
common = tests/grub_cmd_tr.in;
};
script = {
testcase;
name = file_filter_test;
common = tests/file_filter_test.in;
};
script = {
testcase;
name = grub_cmd_test;
common = tests/grub_cmd_test.in;
};
script = {
testcase;
name = syslinux_test;
common = tests/syslinux_test.in;
};
program = {
testcase;
name = example_unit_test;

31
Makefile.utilgcry.def Normal file
View File

@ -0,0 +1,31 @@
AutoGen definitions Makefile.tpl;
library = {
name = libgrubgcry.a;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
extra_dist = grub-core/lib/libgcrypt-grub/cipher/ChangeLog;
common = grub-core/lib/libgcrypt-grub/cipher/arcfour.c;
common = grub-core/lib/libgcrypt-grub/cipher/blowfish.c;
common = grub-core/lib/libgcrypt-grub/cipher/camellia-glue.c;
common = grub-core/lib/libgcrypt-grub/cipher/camellia.c;
common = grub-core/lib/libgcrypt-grub/cipher/cast5.c;
common = grub-core/lib/libgcrypt-grub/cipher/crc.c;
common = grub-core/lib/libgcrypt-grub/cipher/des.c;
common = grub-core/lib/libgcrypt-grub/cipher/idea.c;
common = grub-core/lib/libgcrypt-grub/cipher/md4.c;
common = grub-core/lib/libgcrypt-grub/cipher/md5.c;
common = grub-core/lib/libgcrypt-grub/cipher/rfc2268.c;
common = grub-core/lib/libgcrypt-grub/cipher/rijndael.c;
common = grub-core/lib/libgcrypt-grub/cipher/rmd160.c;
common = grub-core/lib/libgcrypt-grub/cipher/seed.c;
common = grub-core/lib/libgcrypt-grub/cipher/serpent.c;
common = grub-core/lib/libgcrypt-grub/cipher/sha1.c;
common = grub-core/lib/libgcrypt-grub/cipher/sha256.c;
common = grub-core/lib/libgcrypt-grub/cipher/sha512.c;
common = grub-core/lib/libgcrypt-grub/cipher/tiger.c;
common = grub-core/lib/libgcrypt-grub/cipher/twofish.c;
common = grub-core/lib/libgcrypt-grub/cipher/whirlpool.c;
common = grub-core/lib/libgcrypt-grub/cipher/init.c;
};

168
NEWS
View File

@ -1,3 +1,168 @@
New in 2.02:
* New/improved filesystem and disk support:
* Big-endian UFS1.
* Experimental 64-bit ext2 support.
* Various fixes for non-512-byte sector devices.
* New `proc' filesystem framework, used by LUKS disks.
* Fix DM-RAID partition handling.
* New `nativedisk' command to switch from firmware to native disk drivers.
* Compressed HFS+.
* DragonFly BSD labels.
* CBFS (coreboot).
* Handle partitioned LVM properly.
* Use LVM UUIDs whenever possible.
* GPT PReP.
* New `progress' module that shows progress information while reading
files.
* ZFS features support.
* ZFS LZ4 support.
* XFS V5 format support.
* New/improved terminal and video support:
* Monochrome text (matching `hercules' in GRUB Legacy).
* Morse code output using system speaker.
* `spkmodem' output (simple data protocol using system speaker).
* Handle Japanese special keys.
* coreboot framebuffer.
* Serial on ARC.
* Native vt100 handling for grub-emu, replacing the use of the curses
library.
* New gfxmenu options for terminal window positioning, theme background
image handling, and scrollbar padding, plus `item_pixmap_style' and
`highlight_overlay'.
* Support several more image types (paletted and greyscale).
* Boot protocol improvements:
* Support Apple FAT binaries on non-Apple platforms.
* Improve FreeDOS direct loading support compatibility.
* Enable `linux16' on all x86 platforms, not just BIOS.
* New TrueCrypt ISO loader.
* multiboot2 boot-services EFI specification.
* multiboot2 EFI memory map specification.
* multiboot2 full-file specfication.
* New/improved network support:
* New variables `net_default_*' containing properties of the default
interface.
* Autoload `http' and `tftp' modules if necessary.
* Improve TFTP robustness.
* Parse `nd' disk names in GRUB Legacy configuration files.
* Issue separate DNS queries for IPv4 and IPv6.
* Coreboot improvements:
* CBFS support both in on-disk images (loopback) and flash.
* Ability to launch another payload from flash or disk
* Coreboot framebuffer
* CBMEMC support (both logging and inspecting logs)
* Command for inspecting coreboot timestamps (`coreboot_boottime').
* Command for inspecting coreboot tables (`lscoreboot').
* New target default_payload.elf.
* Increased maximal core size.
* Prefer pmtimer for TSC calibration.
* New/improved platform support:
* New `efifwsetup' and `lsefi' commands on EFI platforms.
* New `cmosdump' and `cmosset' commands on platforms with CMOS support.
* New command `pcidump' for PCI platforms.
* Improve opcode parsing in ACPI halt implementation.
* Use the TSC as a possible time source on i386-ieee1275.
* Merge PowerPC grub-mkrescue implementation with the common one.
* Support grub-mkrescue on i386-ieee1275, sparc64, bootinfo machines such
as pSeries, and mips-arc.
* Make grub-mkrescue better support Apple Intel Macs on CD.
* Enable GRUB Legacy configuration file parsing on EFI.
* Support halt for Loongson 2E.
* ARM U-Boot and EFI ports.
* Reorganise platform-dependent code in utilities to avoid #ifdef mess.
* AROS and Haiku support for userspace utilities.
* Xen PV port.
* Fix EFI stack alignment.
* ARM64 EFI port.
* On Linux, read partition start offsets from sysfs if possible.
* New grub-macbless utility, and better integration with Mac firmware in
grub-install.
* Support Yeeloong 3A.
* Add `cpuid --pae' option to detect Physical Address Extension on x86.
* Support for USB debug dongles.
* Support for *-emu on all platforms (previously only i386/x86_64 worked).
* Support *-emu on Windows.
* New platform `none' which builds only user level utilities. This is now
default if target CPU is not supported.
* Support for booting little-endian Linux kernel on powerpc.
* Support network boot with Oracle sun4v vnet devices.
* Added SAS disks to the IEEE 1275 Open Firmware device list.
* Try multiple methods for TSC (timestamp counter) calibration - PIT, pmtimer,
EFI Stall. If everything fails, use hardcoded frequency 800MHz.
* Support Hyper-V Gen2 platforms which lack PIT for TSC calibration.
* Map UEFI Persistent Memory to E820 persistent memory.
* Security:
* Add optional facility to enforce that all files read by the core image
from disk have a valid detached digital signature.
* Performance:
* Avoid costly division operations in many places.
* New boot time analysis framework (`./configure --enable-boot-time').
* Initialise USB ports in parallel.
* New `testspeed' command to test file read speed.
* Speed-up gfxterm by storing intermediate results in more compact format.
* Lazy LVM/mdraid scan.
* Disk hints.
* Scripting:
* New `eval' and `tr' commands.
* grub-script-check fails on scripts containing no commands.
* Installation and other utility improvements:
* Add option to compress files on installation or image creation.
* Using grub-reboot no longer requires setting `GRUB_DEFAULT=saved'.
* Support probing EFI System Partition (requires os-prober >= 1.58).
* Fix inconsistent use of `GRUB_CRYPTODISK_ENABLE' and
`GRUB_ENABLE_CRYPTODISK'; the latter is now used consistently.
* grub-mount handles symbolic links to directories.
* Support disabling submenus with `GRUB_DISABLE_SUBMENU' configuration key
for grub-mkconfig.
* grub-install, grub-mknetdir, grub-mkrescue, and grub-mkstandalone
rewritten in C. They should now work in supported non-Unix-like
environments.
* Native mingw support.
* Ability to install on EFI under windows.
* Reorganise timeout handling using new `timeout_style' environment
variable and `GRUB_TIMEOUT_STYLE' configuration key for grub-mkconfig.
Menu hotkeys pressed during a hidden timeout now boot the corresponding
menu entry immediately.
* New `file' command and grub-file utility to check file types.
* New syslinux configuration file parser.
* Build system:
* Remove all uses of nested functions; GRUB no longer requires an
executable stack.
* Fix documentation build with Texinfo >= 5.1.
* More robust and documented cross-compiling support.
* Partial clang support for some platforms (experimental).
* Partial mingw64 x86_64-efi compile support (highly experimental).
* Partial mingw32 i386-* (other than already present i386-pc)
compile support (highly experimental).
* Support for grub-mkpasswd on Windows.
* Eliminate the use of AutoGen. This allowed some performance
improvements to the build system.
* Remove variable length arrays.
* OpenBSD compile and tools support (NetBSD and FreeBSD were already supported).
* Fix build with FreeType >= 2.5.1.
* Make gentpl.py compatible with Python 3. It now requires at least
Python 2.6.
* modinfo.sh contains build information now.
* Added many new tests to improve robustness.
* Target is built without libgcc now. Necessary builtins are reimplemented
directly. This removes requirement for target-specific runtime on build
system.
* emu libusb support removed (was broken and unmaintained).
* powerpc64le compile support.
* Use fixed timestamp when generating GRUB image for reproducible builds.
* Revision control moved to git.
New in 2.00:
* Appearance:
@ -24,7 +189,6 @@ New in 2.00:
* IEEE1275 serial.
* EFI serial.
* Network stack for BIOS, IEEE1275, EMU and EFI, including TFTP, HTTP and DNS.
* VBE on coreboot support.
* New filesystem, filters and disks formats:
* DVH partition map.
@ -48,7 +212,7 @@ New in 2.00:
* multidevice, mirrored and raidz(2,3) ZFS support.
* RAID LVM (internal RAIDing) support.
* ZFS crypto support.
* ZLE and GZIP on ZFS support.
* ZLE, LZ4 and GZIP on ZFS support.
* Support ZFS up to 33.
* HFS string is now treated like mac-roman and not UTF-8
* HFS mtime support.

2
README
View File

@ -12,8 +12,6 @@ The URL is <http://www.gnu.org/software/grub/grub.html>.
More extensive documentation is available in the Info manual,
accessible using 'info grub' after building and installing GRUB 2.
Please look at the GRUB Wiki <http://grub.enbug.org> for testing
procedures.
There are a number of important user-visible differences from the
first version of GRUB, now known as GRUB Legacy. For a summary, please

4
TODO
View File

@ -7,7 +7,3 @@ glance. So write to <grub-devel@gnu.org> first.
For bug tracking, refer to:
http://savannah.gnu.org/bugs/?group=grub
Our wiki also lists some areas that need work:
http://grub.enbug.org/

View File

@ -93,7 +93,7 @@ else
fi
grub_cv_prog_objcopy_absolute=yes
for link_addr in 0x2000 0x8000 0x7C00; do
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},$link_addr conftest.o -o conftest.exec]); then :
if AC_TRY_COMMAND([${CC-cc} ${TARGET_CFLAGS} ${TARGET_LDFLAGS} -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},$link_addr conftest.o -o conftest.exec]); then :
else
AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
fi
@ -210,80 +210,6 @@ fi
])
dnl Mass confusion!
dnl Older versions of GAS interpret `.code16' to mean ``generate 32-bit
dnl instructions, but implicitly insert addr32 and data32 bytes so
dnl that the code works in real mode''.
dnl
dnl Newer versions of GAS interpret `.code16' to mean ``generate 16-bit
dnl instructions,'' which seems right. This requires the programmer
dnl to explicitly insert addr32 and data32 instructions when they want
dnl them.
dnl
dnl We only support the newer versions, because the old versions cause
dnl major pain, by requiring manual assembly to get 16-bit instructions into
dnl asm files.
AC_DEFUN([grub_I386_ASM_ADDR32],
[AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([grub_I386_ASM_PREFIX_REQUIREMENT])
AC_MSG_CHECKING([for .code16 addr32 assembler support])
AC_CACHE_VAL(grub_cv_i386_asm_addr32,
[cat > conftest.s.in <<\EOF
.code16
l1: @ADDR32@ movb %al, l1
EOF
if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then
sed -e s/@ADDR32@/addr32/ < conftest.s.in > conftest.s
else
sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s
fi
if AC_TRY_COMMAND([${CC-cc} ${TARGET_CCASFLAGS} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
grub_cv_i386_asm_addr32=yes
else
grub_cv_i386_asm_addr32=no
fi
rm -f conftest*])
AC_MSG_RESULT([$grub_cv_i386_asm_addr32])])
dnl Later versions of GAS requires that addr32 and data32 prefixes
dnl appear in the same lines as the instructions they modify, while
dnl earlier versions requires that they appear in separate lines.
AC_DEFUN([grub_I386_ASM_PREFIX_REQUIREMENT],
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING(dnl
[whether addr32 must be in the same line as the instruction])
AC_CACHE_VAL(grub_cv_i386_asm_prefix_requirement,
[cat > conftest.s <<\EOF
.code16
l1: addr32 movb %al, l1
EOF
if AC_TRY_COMMAND([${CC-cc} ${TARGET_CCASFLAGS} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
grub_cv_i386_asm_prefix_requirement=yes
else
grub_cv_i386_asm_prefix_requirement=no
fi
rm -f conftest*])
if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then
grub_tmp_addr32="addr32"
grub_tmp_data32="data32"
else
grub_tmp_addr32="addr32;"
grub_tmp_data32="data32;"
fi
ADDR32=$grub_tmp_addr32
DATA32=$grub_tmp_data32
AC_MSG_RESULT([$grub_cv_i386_asm_prefix_requirement])])
dnl Check what symbol is defined as a bss start symbol.
dnl Written by Michael Hohmoth and Yoshinori K. Okuji.
AC_DEFUN([grub_CHECK_BSS_START_SYMBOL],
@ -418,15 +344,15 @@ else
[fi]
])
dnl Check if ln can handle directories properly (mingw).
dnl Check if ln -s can handle directories properly (mingw).
AC_DEFUN([grub_CHECK_LINK_DIR],[
AC_MSG_CHECKING([whether ln can handle directories properly])
AC_MSG_CHECKING([whether ln -s can handle directories properly])
[mkdir testdir 2>/dev/null
case $srcdir in
[\\/$]* | ?:[\\/]* ) reldir=$srcdir/include/grub/util ;;
*) reldir=../$srcdir/include/grub/util ;;
esac
if ln -s $reldir testdir/util 2>/dev/null ; then]
if ln -s $reldir testdir/util 2>/dev/null && rm -f testdir/util 2>/dev/null ; then]
AC_MSG_RESULT([yes])
[link_dir=yes
else

1268
aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

20
asm-tests/arm.S Normal file
View File

@ -0,0 +1,20 @@
/* on arm clang doesn't support .arch directive */
.text
.syntax unified
#if !defined (__thumb2__)
.arch armv7a
.arm
#else
.arch armv7
.thumb
#endif
mcr p15, 0, r11, c7, c14, 2
/* clang restricts access to dsb/isb despite .arch */
dsb
isb

14
asm-tests/i386-pc.S Normal file
View File

@ -0,0 +1,14 @@
/* on x86 old clang doesn't support .code16
newer clang supports it but creates 6-byte jumps instead of 3-byte ones
which makes us go over boot sector size. */
.code16
jmp far
.org 4
jmp nearer
.org 6
.space 100
nearer:
.space 200
far:
.byte 0

4
asm-tests/i386.S Normal file
View File

@ -0,0 +1,4 @@
/* on x86 old clang doesn't support .code16 */
.code16
movb %al, %bl

11
asm-tests/mips.S Normal file
View File

@ -0,0 +1,11 @@
/* on mips clang doesn't support privilegied instructions, doubleword store/load
and crashes with hand-written assembly
*/
.set mips3
sync
ld $t2, 0($t1)
a:
addiu $t1, $s0, (b - a)
b: nop

8
asm-tests/powerpc.S Normal file
View File

@ -0,0 +1,8 @@
/* clang <= 3.3 doesn't handle most of ppc assembly, not even inline assembly
used by gcrypt */
/* Cache invalidation loop is a fair test. */
li 5, 0
1: icbi 5, 3
addi 5, 5, 32
cmpw 5, 4
blt 1b

9
asm-tests/sparc64.S Normal file
View File

@ -0,0 +1,9 @@
.text
1:
/* A small list of examples of what clang doesn't support. */
clr %o0
lduw [%o4 + 4], %o4
and %o6, ~0xff, %o6
stw %o5, [%o3]
bne,pt %icc, 1b
nop

View File

@ -2,6 +2,9 @@
set -e
# Set ${PYTHON} to plain 'python' if not set already
: ${PYTHON:=python}
export LC_COLLATE=C
unset LC_ALL
@ -9,10 +12,10 @@ find . -iname '*.[ch]' ! -ipath './grub-core/lib/libgcrypt-grub/*' ! -ipath './b
find util -iname '*.in' ! -name Makefile.in |sort > po/POTFILES-shell.in
echo "Importing unicode..."
python util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c
${PYTHON} util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c
echo "Importing libgcrypt..."
python util/import_gcry.py grub-core/lib/libgcrypt/ grub-core
${PYTHON} util/import_gcry.py grub-core/lib/libgcrypt/ grub-core
sed -n -f util/import_gcrypth.sed < grub-core/lib/libgcrypt/src/gcrypt.h.in > include/grub/gcrypt/gcrypt.h
if [ -f include/grub/gcrypt/g10lib.h ]; then
rm include/grub/gcrypt/g10lib.h
@ -20,14 +23,14 @@ fi
if [ -d grub-core/lib/libgcrypt-grub/mpi/generic ]; then
rm -rf grub-core/lib/libgcrypt-grub/mpi/generic
fi
ln -s ../../../grub-core/lib/libgcrypt-grub/src/g10lib.h include/grub/gcrypt/g10lib.h
cp grub-core/lib/libgcrypt-grub/src/g10lib.h include/grub/gcrypt/g10lib.h
cp -R grub-core/lib/libgcrypt/mpi/generic grub-core/lib/libgcrypt-grub/mpi/generic
for x in mpi-asm-defs.h mpih-add1.c mpih-sub1.c mpih-mul1.c mpih-mul2.c mpih-mul3.c mpih-lshift.c mpih-rshift.c; do
if [ -h grub-core/lib/libgcrypt-grub/mpi/"$x" ] || [ -f grub-core/lib/libgcrypt-grub/mpi/"$x" ]; then
rm grub-core/lib/libgcrypt-grub/mpi/"$x"
fi
ln -s generic/"$x" grub-core/lib/libgcrypt-grub/mpi/"$x"
cp grub-core/lib/libgcrypt-grub/mpi/generic/"$x" grub-core/lib/libgcrypt-grub/mpi/"$x"
done
echo "Generating Automake input..."
@ -54,8 +57,8 @@ for extra in contrib/*/Makefile.core.def; do
fi
done
python gentpl.py $UTIL_DEFS > Makefile.util.am
python gentpl.py $CORE_DEFS > grub-core/Makefile.core.am
${PYTHON} gentpl.py $UTIL_DEFS > Makefile.util.am
${PYTHON} gentpl.py $CORE_DEFS > grub-core/Makefile.core.am
for extra in contrib/*/Makefile.common; do
if test -e "$extra"; then

347
build-aux/compile Executable file
View File

@ -0,0 +1,347 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# 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, 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, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

1420
build-aux/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

1799
build-aux/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

791
build-aux/depcomp Executable file
View File

@ -0,0 +1,791 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2013-05-30.07; # UTC
# Copyright (C) 1999-2013 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, 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, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
# Get the directory component of the given path, and save it in the
# global variables '$dir'. Note that this directory component will
# be either empty or ending with a '/' character. This is deliberate.
set_dir_from ()
{
case $1 in
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
*) dir=;;
esac
}
# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}
# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
echo "#dummy" > "$depfile"
}
# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
# If the compiler actually managed to produce a dependency file,
# post-process it.
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependency.h'.
# Do two passes, one to just change these to
# $object: dependency.h
# and one to simply output
# dependency.h:
# which is needed to avoid the deleted-header problem.
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
} > "$depfile"
rm -f "$tmpdepfile"
else
make_dummy_depfile
fi
}
# A tabulation character.
tab=' '
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Avoid interferences from the environment.
gccflag= dashmflag=
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say). Also, it might not be
## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The second -e expression handles DOS-style file names with drive
# letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
| tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
aix_post_process_depfile
;;
tcc)
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
# FIXME: That version still under development at the moment of writing.
# Make that this statement remains true also for stable, released
# versions.
# It will wrap lines (doesn't matter whether long or short) with a
# trailing '\', as in:
#
# foo.o : \
# foo.c \
# foo.h \
#
# It will put a trailing '\' even on the last line, and will use leading
# spaces rather than leading tabs (at least since its commit 0394caf7
# "Emit spaces for -MD").
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
# We have to change lines of the first kind to '$object: \'.
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
# And for each line of the second kind, we have to emit a 'dep.h:'
# dummy dependency, to avoid the deleted-header problem.
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
## The order of this option in the case statement is important, since the
## shell code in configure will try each of these formats in the order
## listed in this file. A plain '-MD' option would be understood by many
## compilers, so we must ensure this comes after the gcc and icc options.
pgcc)
# Portland's C compiler understands '-MD'.
# Will always output deps to 'file.d' where file is the root name of the
# source file under compilation, even if file resides in a subdirectory.
# The object file name does not affect the name of the '.d' file.
# pgcc 10.2 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
set_dir_from "$object"
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
set_base_from "$source"
tmpdepfile=$base.d
# For projects that build the same source file twice into different object
# files, the pgcc approach of using the *source* file root name can cause
# problems in parallel builds. Use a locking strategy to avoid stomping on
# the same $tmpdepfile.
lockdir=$base.d-lock
trap "
echo '$0: caught signal, cleaning up...' >&2
rmdir '$lockdir'
exit 1
" 1 2 13 15
numtries=100
i=$numtries
while test $i -gt 0; do
# mkdir is a portable test-and-set.
if mkdir "$lockdir" 2>/dev/null; then
# This process acquired the lock.
"$@" -MD
stat=$?
# Release the lock.
rmdir "$lockdir"
break
else
# If the lock is being held by a different process, wait
# until the winning process is done or we timeout.
while test -d "$lockdir" && test $i -gt 0; do
sleep 1
i=`expr $i - 1`
done
fi
i=`expr $i - 1`
done
trap - 1 2 13 15
if test $i -le 0; then
echo "$0: failed to acquire lock after $numtries attempts" >&2
echo "$0: check lockdir '$lockdir'" >&2
exit 1
fi
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
# Libtool generates 2 separate objects for the 2 libraries. These
# two compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir$base.o.d # libtool 1.5
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
# Same post-processing that is required for AIX mode.
aix_post_process_depfile
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this sed invocation
# correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process the last invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed '1,2d' "$tmpdepfile" \
| tr ' ' "$nl" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E \
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
| sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

527
build-aux/install-sh Executable file
View File

@ -0,0 +1,527 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2011-11-20.07; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

224
build-aux/mdate-sh Executable file
View File

@ -0,0 +1,224 @@
#!/bin/sh
# Get modification time of a file or directory and pretty-print it.
scriptversion=2010-08-21.06; # UTC
# Copyright (C) 1995-2013 Free Software Foundation, Inc.
# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995
#
# 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, 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, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
fi
case $1 in
'')
echo "$0: No file. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: mdate-sh [--help] [--version] FILE
Pretty-print the modification day of FILE, in the format:
1 January 1970
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "mdate-sh $scriptversion"
exit $?
;;
esac
error ()
{
echo "$0: $1" >&2
exit 1
}
# Prevent date giving response in another language.
LANG=C
export LANG
LC_ALL=C
export LC_ALL
LC_TIME=C
export LC_TIME
# GNU ls changes its time format in response to the TIME_STYLE
# variable. Since we cannot assume 'unset' works, revert this
# variable to its documented default.
if test "${TIME_STYLE+set}" = set; then
TIME_STYLE=posix-long-iso
export TIME_STYLE
fi
save_arg1=$1
# Find out how to get the extended ls output of a file or directory.
if ls -L /dev/null 1>/dev/null 2>&1; then
ls_command='ls -L -l -d'
else
ls_command='ls -l -d'
fi
# Avoid user/group names that might have spaces, when possible.
if ls -n /dev/null 1>/dev/null 2>&1; then
ls_command="$ls_command -n"
fi
# A 'ls -l' line looks as follows on OS/2.
# drwxrwx--- 0 Aug 11 2001 foo
# This differs from Unix, which adds ownership information.
# drwxrwx--- 2 root root 4096 Aug 11 2001 foo
#
# To find the date, we split the line on spaces and iterate on words
# until we find a month. This cannot work with files whose owner is a
# user named "Jan", or "Feb", etc. However, it's unlikely that '/'
# will be owned by a user whose name is a month. So we first look at
# the extended ls output of the root directory to decide how many
# words should be skipped to get the date.
# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below.
set x`$ls_command /`
# Find which argument is the month.
month=
command=
until test $month
do
test $# -gt 0 || error "failed parsing '$ls_command /' output"
shift
# Add another shift to the command.
command="$command shift;"
case $1 in
Jan) month=January; nummonth=1;;
Feb) month=February; nummonth=2;;
Mar) month=March; nummonth=3;;
Apr) month=April; nummonth=4;;
May) month=May; nummonth=5;;
Jun) month=June; nummonth=6;;
Jul) month=July; nummonth=7;;
Aug) month=August; nummonth=8;;
Sep) month=September; nummonth=9;;
Oct) month=October; nummonth=10;;
Nov) month=November; nummonth=11;;
Dec) month=December; nummonth=12;;
esac
done
test -n "$month" || error "failed parsing '$ls_command /' output"
# Get the extended ls output of the file or directory.
set dummy x`eval "$ls_command \"\\\$save_arg1\""`
# Remove all preceding arguments
eval $command
# Because of the dummy argument above, month is in $2.
#
# On a POSIX system, we should have
#
# $# = 5
# $1 = file size
# $2 = month
# $3 = day
# $4 = year or time
# $5 = filename
#
# On Darwin 7.7.0 and 7.6.0, we have
#
# $# = 4
# $1 = day
# $2 = month
# $3 = year or time
# $4 = filename
# Get the month.
case $2 in
Jan) month=January; nummonth=1;;
Feb) month=February; nummonth=2;;
Mar) month=March; nummonth=3;;
Apr) month=April; nummonth=4;;
May) month=May; nummonth=5;;
Jun) month=June; nummonth=6;;
Jul) month=July; nummonth=7;;
Aug) month=August; nummonth=8;;
Sep) month=September; nummonth=9;;
Oct) month=October; nummonth=10;;
Nov) month=November; nummonth=11;;
Dec) month=December; nummonth=12;;
esac
case $3 in
???*) day=$1;;
*) day=$3; shift;;
esac
# Here we have to deal with the problem that the ls output gives either
# the time of day or the year.
case $3 in
*:*) set `date`; eval year=\$$#
case $2 in
Jan) nummonthtod=1;;
Feb) nummonthtod=2;;
Mar) nummonthtod=3;;
Apr) nummonthtod=4;;
May) nummonthtod=5;;
Jun) nummonthtod=6;;
Jul) nummonthtod=7;;
Aug) nummonthtod=8;;
Sep) nummonthtod=9;;
Oct) nummonthtod=10;;
Nov) nummonthtod=11;;
Dec) nummonthtod=12;;
esac
# For the first six month of the year the time notation can also
# be used for files modified in the last year.
if (expr $nummonth \> $nummonthtod) > /dev/null;
then
year=`expr $year - 1`
fi;;
*) year=$3;;
esac
# The result.
echo $day $month $year
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

215
build-aux/missing Executable file
View File

@ -0,0 +1,215 @@
#! /bin/sh
# Common wrapper for a few potentially missing GNU programs.
scriptversion=2013-10-28.13; # UTC
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# 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, 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, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
case $1 in
--is-lightweight)
# Used by our autoconf macros to check whether the available missing
# script is modern enough.
exit 0
;;
--run)
# Back-compat with the calling convention used by older automake.
shift
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal autoconf autoheader autom4te automake makeinfo
bison yacc flex lex help2man
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
'g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: unknown '$1' option"
echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
# Run the given program, remember its exit status.
"$@"; st=$?
# If it succeeded, we are done.
test $st -eq 0 && exit 0
# Also exit now if we it failed (or wasn't found), and '--version' was
# passed; such an option is passed most likely to detect whether the
# program is present and works.
case $2 in --version|--help) exit $st;; esac
# Exit code 63 means version mismatch. This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
msg="probably too old"
elif test $st -eq 127; then
# Program was missing.
msg="missing on your system"
else
# Program was found and executed, but failed. Give up.
exit $st
fi
perl_URL=http://www.perl.org/
flex_URL=http://flex.sourceforge.net/
gnu_software_URL=http://www.gnu.org/software
program_details ()
{
case $1 in
aclocal|automake)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/autoconf>"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
autoconf|autom4te|autoheader)
echo "The '$1' program is part of the GNU Autoconf package:"
echo "<$gnu_software_URL/autoconf/>"
echo "It also requires GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
esac
}
give_advice ()
{
# Normalize program name to check for.
normalized_program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
printf '%s\n' "'$1' is $msg."
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
case $normalized_program in
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
echo "You might want to install the Texinfo package:"
echo "<$gnu_software_URL/texinfo/>"
echo "The spurious makeinfo call might also be the consequence of"
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
echo "often tells you about the needed prerequisites for installing"
echo "this package. You may also peek at any GNU archive site, in"
echo "case some other package contains this missing '$1' program."
;;
esac
}
give_advice "$1" | sed -e '1s/^/WARNING: /' \
-e '2,$s/^/ /' >&2
# Propagate the correct exit status (expected to be 127 for a program
# not found, 63 for a program that failed due to version mismatch).
exit $st
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

139
build-aux/test-driver Executable file
View File

@ -0,0 +1,139 @@
#! /bin/sh
# test-driver - basic testsuite driver script.
scriptversion=2013-07-13.22; # UTC
# Copyright (C) 2011-2013 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, 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, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
# Make unconditional expansion of undefined variables an error. This
# helps a lot in preventing typo-related bugs.
set -u
usage_error ()
{
echo "$0: $*" >&2
print_usage >&2
exit 2
}
print_usage ()
{
cat <<END
Usage:
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
[--expect-failure={yes|no}] [--color-tests={yes|no}]
[--enable-hard-errors={yes|no}] [--]
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
END
}
test_name= # Used for reporting.
log_file= # Where to save the output of the test script.
trs_file= # Where to save the metadata of the test run.
expect_failure=no
color_tests=no
enable_hard_errors=yes
while test $# -gt 0; do
case $1 in
--help) print_usage; exit $?;;
--version) echo "test-driver $scriptversion"; exit $?;;
--test-name) test_name=$2; shift;;
--log-file) log_file=$2; shift;;
--trs-file) trs_file=$2; shift;;
--color-tests) color_tests=$2; shift;;
--expect-failure) expect_failure=$2; shift;;
--enable-hard-errors) enable_hard_errors=$2; shift;;
--) shift; break;;
-*) usage_error "invalid option: '$1'";;
*) break;;
esac
shift
done
missing_opts=
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
test x"$log_file" = x && missing_opts="$missing_opts --log-file"
test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
if test x"$missing_opts" != x; then
usage_error "the following mandatory options are missing:$missing_opts"
fi
if test $# -eq 0; then
usage_error "missing argument"
fi
if test $color_tests = yes; then
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
red='' # Red.
grn='' # Green.
lgn='' # Light green.
blu='' # Blue.
mgn='' # Magenta.
std='' # No color.
else
red= grn= lgn= blu= mgn= std=
fi
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
trap "st=129; $do_exit" 1
trap "st=130; $do_exit" 2
trap "st=141; $do_exit" 13
trap "st=143; $do_exit" 15
# Test script is run here.
"$@" >$log_file 2>&1
estatus=$?
if test $enable_hard_errors = no && test $estatus -eq 99; then
estatus=1
fi
case $estatus:$expect_failure in
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
0:*) col=$grn res=PASS recheck=no gcopy=no;;
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
esac
# Report outcome to console.
echo "${col}${res}${std}: $test_name"
# Register the test result, and other relevant metadata.
echo ":test-result: $res" > $trs_file
echo ":global-test-result: $res" >> $trs_file
echo ":recheck: $recheck" >> $trs_file
echo ":copy-in-global-log: $gcopy" >> $trs_file
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

10079
build-aux/texinfo.tex Normal file

File diff suppressed because it is too large Load Diff

View File

@ -7,12 +7,7 @@ unexport LC_ALL
# Platform specific options
if COND_sparc64_ieee1275
CFLAGS_PLATFORM += -mno-app-regs
LDFLAGS_PLATFORM = -Wl,-melf64_sparc -Wl,--no-relax
endif
if COND_sparc64_emu
CFLAGS_PLATFORM += -mno-app-regs
LDFLAGS_PLATFORM = -Wl,--no-relax
LDFLAGS_PLATFORM = -Wl,-melf64_sparc
endif
if COND_arm
if !COND_emu
@ -22,9 +17,9 @@ endif
if COND_arm64
CFLAGS_PLATFORM += -mcmodel=large
endif
#FIXME: discover and check XEN headers
CPPFLAGS_XEN = -I/usr/include
if COND_powerpc_ieee1275
CFLAGS_PLATFORM += -mcpu=powerpc
endif
# Other options
@ -39,21 +34,19 @@ CPPFLAGS_DEFAULT += -I$(top_srcdir)/grub-core/lib/libgcrypt-grub/src/
CCASFLAGS_DEFAULT = $(CPPFLAGS_DEFAULT) -DASM_FILE=1
BUILD_CPPFLAGS += $(CPPFLAGS_DEFAULT)
LDADD_KERNEL = $(TARGET_LIBGCC)
CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) $(TARGET_LDFLAGS_STATIC_LIBGCC)
CFLAGS_KERNEL = $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_KERNEL = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC)
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM) -DGRUB_KERNEL=1
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version
STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version -R .MIPS.abiflags -R .ARM.exidx
CFLAGS_MODULE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_MODULE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
CFLAGS_MODULE = $(CFLAGS_PLATFORM) -ffreestanding
LDFLAGS_MODULE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-r,-d
CPPFLAGS_MODULE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
CCASFLAGS_MODULE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
CFLAGS_IMAGE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -fno-builtin
LDFLAGS_IMAGE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-S
CFLAGS_IMAGE = $(CFLAGS_PLATFORM) -fno-builtin
LDFLAGS_IMAGE = $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-S
CPPFLAGS_IMAGE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
CCASFLAGS_IMAGE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)

View File

@ -5,6 +5,7 @@ EXTRA_DIST += gentpl.py
EXTRA_DIST += Makefile.util.def
EXTRA_DIST += Makefile.utilgcry.def
EXTRA_DIST += asm-tests
EXTRA_DIST += unicode
EXTRA_DIST += util/import_gcry.py
@ -36,7 +37,6 @@ EXTRA_DIST += grub-core/lib/libgcrypt
EXTRA_DIST += grub-core/lib/libgcrypt-grub/mpi/generic
EXTRA_DIST += $(shell find $(top_srcdir)/include -name '*.h')
EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/lib -name '*.h')
EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/gnulib -name '*.h')
EXTRA_DIST += grub-core/efiemu/runtime/config.h
EXTRA_DIST += grub-core/lib/LzmaDec.c
@ -50,8 +50,13 @@ EXTRA_DIST += util/import_gcrypth.sed
EXTRA_DIST += util/bin2h.c
EXTRA_DIST += util/grub-gen-asciih.c
EXTRA_DIST += util/grub-gen-widthspec.c
EXTRA_DIST += util/grub-module-verifier.c
EXTRA_DIST += util/grub-module-verifier32.c
EXTRA_DIST += util/grub-module-verifier64.c
EXTRA_DIST += util/grub-module-verifierXX.c
EXTRA_DIST += util/grub-pe2elf.c
EXTRA_DIST += m4/gnulib-cache.m4
EXTRA_DIST += m4/glibc2.m4
EXTRA_DIST += m4/gnulib-tool.m4
@ -110,3 +115,26 @@ EXTRA_DIST += tests/dfly-mbr-mbexample.mbr.img.gz
EXTRA_DIST += tests/dfly-mbr-mbexample.dfly.img.gz
EXTRA_DIST += coreboot.cfg
EXTRA_DIST += tests/file_filter/file
EXTRA_DIST += tests/file_filter/file.gz
EXTRA_DIST += tests/file_filter/file.gz.sig
EXTRA_DIST += tests/file_filter/file.lzop
EXTRA_DIST += tests/file_filter/file.lzop.sig
EXTRA_DIST += tests/file_filter/file.xz
EXTRA_DIST += tests/file_filter/file.xz.sig
EXTRA_DIST += tests/file_filter/keys
EXTRA_DIST += tests/file_filter/keys.pub
EXTRA_DIST += tests/file_filter/test.cfg
EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/prompt.cfg
EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/gfxboot.cfg
EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/adtxt.cfg
EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/isolinux.cfg
EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/exithelp.cfg
EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/txt.cfg
EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/menu.cfg
EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/stdmenu.cfg
EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/dtmenu.cfg
EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/po4a.cfg
EXTRA_DIST += tests/syslinux/ubuntu10.04/isolinux/rqtxt.cfg
EXTRA_DIST += tests/syslinux/ubuntu10.04_grub.cfg.in

1675
config-util.h.in Normal file

File diff suppressed because it is too large Load Diff

View File

@ -7,11 +7,20 @@
#endif
#define GCRYPT_NO_DEPRECATED 1
#define HAVE_MEMMOVE 1
/* Define to 1 to enable disk cache statistics. */
#define DISK_CACHE_STATS @DISK_CACHE_STATS@
#define BOOT_TIME_STATS @BOOT_TIME_STATS@
/* We don't need those. */
#define MINILZO_CFG_SKIP_LZO_PTR 1
#define MINILZO_CFG_SKIP_LZO_UTIL 1
#define MINILZO_CFG_SKIP_LZO_STRING 1
#define MINILZO_CFG_SKIP_LZO_INIT 1
#define MINILZO_CFG_SKIP_LZO1X_1_COMPRESS 1
#define MINILZO_CFG_SKIP_LZO1X_DECOMPRESS 1
#if defined (GRUB_BUILD)
#undef ENABLE_NLS
#define BUILD_SIZEOF_LONG @BUILD_SIZEOF_LONG@
@ -31,10 +40,6 @@
#define HAVE_FONT_SOURCE @HAVE_FONT_SOURCE@
/* Define if C symbols get an underscore after compilation. */
#define HAVE_ASM_USCORE @HAVE_ASM_USCORE@
/* Define it to \"addr32\" or \"addr32;\" to make GAS happy. */
#define ADDR32 @ADDR32@
/* Define it to \"data32\" or \"data32;\" to make GAS happy. */
#define DATA32 @DATA32@
/* Define it to one of __bss_start, edata and _edata. */
#define BSS_START_SYMBOL @BSS_START_SYMBOL@
/* Define it to either end or _end. */

30592
configure vendored Executable file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1562
docs/Makefile.in Normal file

File diff suppressed because it is too large Load Diff

2516
docs/grub-dev.info Normal file

File diff suppressed because it is too large Load Diff

View File

@ -108,16 +108,16 @@ The branches available are:
@table @samp
@item master
Main developpement branch.
Main development branch.
@item grub-legacy
GRUB 0.97 codebase. Kept for reference and legal reasons
@item multiboot
Multiboot specfication
@item multiboot2
Multiboot2 specfication
@item developper branches
Prefixed with developper name. Every developper of a team manages his own branches.
Developper branches do not need changelog entries.
@item developer branches
Prefixed with developer name. Every developer of a team manages his own branches.
Developer branches do not need changelog entries.
@end table
Once you have used @kbd{git clone} to fetch an initial copy of a branch, you
@ -228,12 +228,12 @@ The opening @samp{/*} and closing @samp{*/} should be placed together on a line
Here is a brief map of the GRUB code base.
GRUB uses Autoconf and Automake, with most of the Automake input generated
by AutoGen. The top-level build rules are in @file{configure.ac},
by a Python script. The top-level build rules are in @file{configure.ac},
@file{grub-core/Makefile.core.def}, and @file{Makefile.util.def}. Each
block in a @file{*.def} file represents a build target, and specifies the
source files used to build it on various platforms. The @file{*.def} files
are processed into AutoGen input by @file{gentpl.py} (which you only need to
look at if you are extending the build system). If you are adding a new
are processed into Automake input by @file{gentpl.py} (which you only need
to look at if you are extending the build system). If you are adding a new
module which follows an existing pattern, such as a new command or a new
filesystem implementation, it is usually easiest to grep
@file{grub-core/Makefile.core.def} and @file{Makefile.util.def} for an

7446
docs/grub.info Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2538,6 +2538,8 @@ team are:
85:3
@item Asus EeePC 1005PE
84:1 (unconfirmed)
@item LENOVO ThinkPad T410s (2912W1C)
101:3
@end table
To take full advantage of this function, install GRUB into the MBR
@ -3038,6 +3040,8 @@ These variables have special meaning to GRUB.
* cmdpath::
* color_highlight::
* color_normal::
* config_directory::
* config_file::
* debug::
* default::
* fallback::
@ -3180,6 +3184,22 @@ matching colors of first half.
to support whole rgb24 palette but currently there is no compelling reason
to go beyond the current 16 colors.
@node config_directory
@subsection config_directory
This variable is automatically set by GRUB to the directory part of
current configuration file name (@pxref{config_file}).
@node config_file
@subsection config_file
This variable is automatically set by GRUB to the name of configuration file that is being
processed by commands @command{configfile} (@pxref{configfile}) or @command{normal}
(@pxref{normal}). It is restored to the previous value when command completes.
@node debug
@subsection debug
@ -3839,6 +3859,11 @@ you forget a command, you can run the command @command{help}
@comment * vbeinfo:: List available video modes
* verify_detached:: Verify detached digital signature
* videoinfo:: List available video modes
@comment * xen_*:: Xen boot commands
* xen_hypervisor:: Load xen hypervisor binary
* xen_linux:: Load dom0 kernel for xen hypervisor
* xen_initrd:: Load dom0 initrd for dom0 kernel
* xen_xsm:: Load xen security module for xen hypervisor
@end menu
@ -4050,12 +4075,15 @@ after @command{configfile} returns.
@node cpuid
@subsection cpuid
@deffn Command cpuid [-l]
@deffn Command cpuid [-l] [-p]
Check for CPU features. This command is only available on x86 systems.
With the @option{-l} option, return true if the CPU supports long mode
(64-bit).
With the @option{-p} option, return true if the CPU supports Physical
Address Extension (PAE).
If invoked without options, this command currently behaves as if it had been
invoked with @option{-l}. This may change in the future.
@end deffn
@ -5019,6 +5047,8 @@ the length of @var{string} is zero
@var{expression} is false
@item @var{expression1} @code{-a} @var{expression2}
both @var{expression1} and @var{expression2} are true
@item @var{expression1} @var{expression2}
both @var{expression1} and @var{expression2} are true. This syntax is not POSIX-compliant and is not recommended.
@item @var{expression1} @code{-o} @var{expression2}
either @var{expression1} or @var{expression2} is true
@end table
@ -5102,6 +5132,39 @@ successfully. If validation fails, it is set to a non-zero value.
List available video modes. If resolution is given, show only matching modes.
@end deffn
@node xen_hypervisor
@subsection xen_hypervisor
@deffn Command xen_hypervisor file [arguments] @dots{}
Load a Xen hypervisor binary from @var{file}. The rest of the line is passed
verbatim as the @dfn{kernel command-line}. Any other binaries must be
reloaded after using this command.
@end deffn
@node xen_linux
@subsection xen_linux
@deffn Command xen_linux file [arguments]
Load a dom0 kernel image for xen hypervisor at the booting process of xen.
The rest of the line is passed verbatim as the module command line.
@end deffn
@node xen_initrd
@subsection xen_initrd
@deffn Command xen_initrd file
Load a initrd image for dom0 kernel at the booting process of xen.
@end deffn
@node xen_xsm
@subsection xen_xsm
@deffn Command xen_xsm file
Load a xen security module for xen hypervisor at the booting process of xen.
See @uref{http://wiki.xen.org/wiki/XSM} for more detail.
@end deffn
@node Networking commands
@section The list of networking commands
@ -5162,8 +5225,10 @@ by @var{shortname} which can be used to remove it (@pxref{net_del_route}).
Perform configuration of @var{card} using DHCP protocol. If no card name
is specified, try to configure all existing cards. If configuration was
successful, interface with name @var{card}@samp{:dhcp} and configured
address is added to @var{card}. If server provided gateway information in
DHCP ACK packet, it is added as route entry with the name @var{card}@samp{:dhcp:gw}. Additionally the following DHCP options are recognized and processed:
address is added to @var{card}.
@comment If server provided gateway information in
@comment DHCP ACK packet, it is added as route entry with the name @var{card}@samp{:dhcp:gw}.
Additionally the following DHCP options are recognized and processed:
@table @samp
@item 1 (Subnet Mask)
@ -5426,10 +5491,12 @@ In order to enable authentication support, the @samp{superusers} environment
variable must be set to a list of usernames, separated by any of spaces,
commas, semicolons, pipes, or ampersands. Superusers are permitted to use
the GRUB command line, edit menu entries, and execute any menu entry. If
@samp{superusers} is set, then use of the command line is automatically
restricted to superusers.
@samp{superusers} is set, then use of the command line and editing of menu
entries are automatically restricted to superusers. Setting @samp{superusers}
to empty string effectively disables both access to CLI and editing of menu
entries.
Other users may be given access to specific menu entries by giving a list of
Other users may be allowed to execute specific menu entries by giving a list of
usernames (as above) using the @option{--users} option to the
@samp{menuentry} command (@pxref{menuentry}). If the @option{--unrestricted}
option is used for a menu entry, then that entry is unrestricted.
@ -5609,6 +5676,16 @@ BadRAM is the ability to mark some of the RAM as ``bad''. Note: due to protocol
limitations mips-loongson (with Linux protocol)
and mips-qemu_mips can use only memory up to first hole.
Bootlocation is ability of GRUB to automatically detect where it boots from.
``disk'' means the detection is limited to detecting the disk with partition
being discovered on install time. ``partition'' means that disk and partiton
can be automatically discovered. ``file'' means that boot image file name as
well as disk and partition can be discovered. For consistency default install ignores
partition and relies solely on disk detection. If no bootlocation discovery is available
or boot and grub-root disks are different, UUID is used instead. On ARC if no device
to install to is specified, UUID is used instead as well.
@multitable @columnfractions .20 .20 .20 .20 .20
@item @tab BIOS @tab Coreboot @tab Multiboot @tab Qemu
@item video @tab yes @tab yes @tab yes @tab yes
@ -5625,6 +5702,7 @@ and mips-qemu_mips can use only memory up to first hole.
@item badram @tab yes @tab yes @tab yes @tab yes
@item compression @tab always @tab pointless @tab no @tab no
@item exit @tab yes @tab no @tab no @tab no
@item bootlocation @tab disk @tab no @tab no @tab no
@end multitable
@multitable @columnfractions .20 .20 .20 .20 .20
@ -5643,6 +5721,7 @@ and mips-qemu_mips can use only memory up to first hole.
@item badram @tab yes @tab yes @tab no @tab yes
@item compression @tab no @tab no @tab no @tab no
@item exit @tab yes @tab yes @tab yes @tab yes
@item bootlocation @tab file @tab file @tab file, ignored @tab file
@end multitable
@multitable @columnfractions .20 .20 .20 .20 .20
@ -5661,24 +5740,26 @@ and mips-qemu_mips can use only memory up to first hole.
@item badram @tab yes (*) @tab no @tab no @tab no
@item compression @tab configurable @tab no @tab no @tab configurable
@item exit @tab no @tab yes @tab yes @tab yes
@item bootlocation @tab no @tab partition @tab file @tab file (*)
@end multitable
@multitable @columnfractions .20 .20 .20 .20 .20
@item @tab MIPS qemu @tab emu
@item video @tab no @tab yes
@item console charset @tab CP437 @tab Unicode (*)
@item network @tab no @tab yes
@item ATA/AHCI @tab yes @tab no
@item AT keyboard @tab yes @tab no
@item Speaker @tab no @tab no
@item USB @tab N/A @tab yes
@item chainloader @tab yes @tab no
@item cpuid @tab no @tab no
@item hints @tab guess @tab no
@item PCI @tab no @tab no
@item badram @tab yes (*) @tab no
@item compression @tab configurable @tab no
@item exit @tab no @tab yes
@item @tab MIPS qemu @tab emu @tab xen
@item video @tab no @tab yes @tab no
@item console charset @tab CP437 @tab Unicode (*) @tab ASCII
@item network @tab no @tab yes @tab no
@item ATA/AHCI @tab yes @tab no @tab no
@item AT keyboard @tab yes @tab no @tab no
@item Speaker @tab no @tab no @tab no
@item USB @tab N/A @tab yes @tab no
@item chainloader @tab yes @tab no @tab yes
@item cpuid @tab no @tab no @tab yes
@item hints @tab guess @tab no @tab no
@item PCI @tab no @tab no @tab no
@item badram @tab yes (*) @tab no @tab no
@item compression @tab configurable @tab no @tab no
@item exit @tab no @tab yes @tab no
@item bootlocation @tab no @tab file @tab no
@end multitable
@node Platform-specific operations
@ -5848,7 +5929,7 @@ Following variables must be defined:
@multitable @columnfractions .30 .65
@item GRUB_PAYLOADS_DIR @tab directory containing the required kernels
@item GRUB_CBFSTOOL @tab cbfstoll from Coreboot package (for coreboot platform only)
@item GRUB_CBFSTOOL @tab cbfstool from Coreboot package (for coreboot platform only)
@item GRUB_COREBOOT_ROM @tab empty Coreboot ROM
@item GRUB_QEMU_OPTS @tab additional options to be supplied to QEMU
@end multitable

4
docs/stamp-1 Normal file
View File

@ -0,0 +1,4 @@
@set UPDATED 2 September 2015
@set UPDATED-MONTH September 2015
@set EDITION 2.02~beta3
@set VERSION 2.02~beta3

4
docs/stamp-vti Normal file
View File

@ -0,0 +1,4 @@
@set UPDATED 12 February 2016
@set UPDATED-MONTH February 2016
@set EDITION 2.02~beta3
@set VERSION 2.02~beta3

4
docs/version-dev.texi Normal file
View File

@ -0,0 +1,4 @@
@set UPDATED 2 September 2015
@set UPDATED-MONTH September 2015
@set EDITION 2.02~beta3
@set VERSION 2.02~beta3

4
docs/version.texi Normal file
View File

@ -0,0 +1,4 @@
@set UPDATED 12 February 2016
@set UPDATED-MONTH February 2016
@set EDITION 2.02~beta3
@set VERSION 2.02~beta3

View File

@ -76,7 +76,13 @@ for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)
# Flattened Device Trees (FDT)
GROUPS["fdt"] = [ "arm64_efi", "arm_uboot", "arm_efi" ]
# Miscelaneous groups schedulded to disappear in future
# Needs software helpers for division
# Must match GRUB_DIVISION_IN_SOFTWARE in misc.h
GROUPS["softdiv"] = GROUPS["arm"] + ["ia64_efi"]
GROUPS["no_softdiv"] = GRUB_PLATFORMS[:]
for i in GROUPS["softdiv"]: GROUPS["no_softdiv"].remove(i)
# Miscellaneous groups scheduled to disappear in future
GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"]
GROUPS["nopc"] = GRUB_PLATFORMS[:]; GROUPS["nopc"].remove("i386_pc")
@ -600,7 +606,7 @@ def foreach_enabled_platform(defn, closure):
# enable = emu;
# enable = i386;
# enable = mips_loongson;
# emu_condition = COND_GRUB_EMU_USB;
# emu_condition = COND_GRUB_EMU_SDL;
# };
#
def under_platform_specific_conditionals(defn, platform, closure):
@ -723,9 +729,11 @@ def kernel(defn, platform):
"""if test x$(TARGET_APPLE_LINKER) = x1; then \
$(TARGET_STRIP) -S -x $(""" + cname(defn) + """) -o $@.bin $<; \
$(TARGET_OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -ed2022 -ed2016 -wd1106 -nu -nd $@.bin $@; \
rm -f $@.bin; \
elif test ! -z '$(TARGET_OBJ2ELF)'; then \
""" + "$(TARGET_STRIP) $(" + cname(defn) + "_STRIPFLAGS) -o $@.bin $< && \
$(TARGET_OBJ2ELF) $@.bin $@ || (rm -f $@; rm -f $@.bin; exit 1); \
rm -f $@.bin; \
else """ + "$(TARGET_STRIP) $(" + cname(defn) + "_STRIPFLAGS) -o $@ $<; \
fi"""))
@ -753,7 +761,7 @@ def image(defn, platform):
if test x$(TARGET_APPLE_LINKER) = x1; then \
$(MACHO2IMG) $< $@; \
else \
$(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@; \
$(TARGET_OBJCOPY) $(""" + cname(defn) + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .MIPS.abiflags -R .reginfo -R .rel.dyn -R .note.gnu.gold-version -R .ARM.exidx $< $@; \
fi
""")
@ -828,6 +836,20 @@ def data(defn, platform):
var_add("dist_" + installdir(defn) + "_DATA", platform_sources(defn, platform))
gvar_add("dist_noinst_DATA", extra_dist(defn))
def transform_data(defn, platform):
name = defn['name']
var_add(installdir(defn) + "_DATA", name)
rule(name, "$(top_builddir)/config.status " + platform_sources(defn, platform) + platform_dependencies(defn, platform), """
(for x in """ + platform_sources(defn, platform) + """; do cat $(srcdir)/"$$x"; done) | $(top_builddir)/config.status --file=$@:-
chmod a+x """ + name + """
""")
gvar_add("CLEANFILES", name)
gvar_add("EXTRA_DIST", extra_dist(defn))
gvar_add("dist_noinst_DATA", platform_sources(defn, platform))
def script(defn, platform):
name = defn['name']
@ -875,6 +897,7 @@ rules("library", library)
rules("program", program)
rules("script", script)
rules("data", data)
rules("transform_data", transform_data)
write_output(section='decl')
write_output()

View File

@ -26,20 +26,26 @@ CFLAGS_LIBRARY += $(CFLAGS_PLATFORM) -fno-builtin
CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM)
CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM)
build-grub-pep2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^
build-grub-pep2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^
CLEANFILES += build-grub-pep2elf$(BUILD_EXEEXT)
build-grub-pe2elf: $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^
build-grub-pe2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^
CLEANFILES += build-grub-pe2elf$(BUILD_EXEEXT)
# gentrigtables
gentrigtables: gentrigtables.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $< $(BUILD_LIBM)
CLEANFILES += gentrigtables
gentrigtables$(BUILD_EXEEXT): gentrigtables.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM)
CLEANFILES += gentrigtables$(BUILD_EXEEXT)
build-grub-module-verifier$(BUILD_EXEEXT): $(top_srcdir)/util/grub-module-verifier.c $(top_srcdir)/util/grub-module-verifier32.c $(top_srcdir)/util/grub-module-verifier64.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-module-verifier\" $^
CLEANFILES += build-grub-module-verifier$(BUILD_EXEEXT)
# trigtables.c
trigtables.c: gentrigtables gentrigtables.c $(top_srcdir)/configure.ac
./gentrigtables > $@
trigtables.c: gentrigtables$(BUILD_EXEEXT) gentrigtables.c $(top_srcdir)/configure.ac
./gentrigtables$(BUILD_EXEEXT) > $@
CLEANFILES += trigtables.c
# XXX Use Automake's LEX & YACC support
@ -74,6 +80,11 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h
if COND_emu
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt-emu.h
else
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt.h
endif
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/parser.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/partition.h
@ -81,9 +92,6 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h
if !COND_clang
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
endif
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h
if COND_i386_pc
@ -97,7 +105,9 @@ if COND_i386_efi
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h
endif
if COND_i386_coreboot
@ -108,10 +118,12 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
endif
if COND_i386_multiboot
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
endif
if COND_i386_qemu
@ -150,11 +162,14 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h
endif
if COND_ia64_efi
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
endif
if COND_mips
@ -229,11 +244,13 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/efi/loader.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
endif
if COND_arm64_efi
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
endif
if COND_emu
@ -246,9 +263,6 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
if COND_GRUB_EMU_SDL
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h
endif
if COND_GRUB_EMU_USB
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libusb.h
endif
if COND_GRUB_EMU_PCI
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libpciaccess.h
endif
@ -292,12 +306,12 @@ grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h
kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h
grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h
grub_emu_init.h: genemuinitheader.sh $(MOD_FILES)
rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@
grub_emu_init.h: genemuinitheader.sh $(MODULE_FILES)
rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@
CLEANFILES += grub_emu_init.h
grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES)
rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MODULE_FILES)
rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
CLEANFILES += grub_emu_init.c
endif
@ -382,7 +396,7 @@ moddep.lst: syminfo.lst genmoddep.awk video.lst
platform_DATA += moddep.lst
CLEANFILES += config.log syminfo.lst moddep.lst
$(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT)
$(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT) build-grub-module-verifier$(BUILD_EXEEXT)
TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@
platform_DATA += $(MOD_FILES)
platform_DATA += modinfo.sh

20872
grub-core/Makefile.core.am Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +1,43 @@
AutoGen definitions Makefile.tpl;
script = {
transform_data = {
installdir = noinst;
name = gensyminfo.sh;
common = gensyminfo.sh.in;
};
script = {
transform_data = {
installdir = noinst;
name = genmod.sh;
common = genmod.sh.in;
};
script = {
transform_data = {
installdir = noinst;
name = modinfo.sh;
common = modinfo.sh.in;
};
script = {
transform_data = {
installdir = platform;
name = gmodule.pl;
common = gmodule.pl.in;
};
script = {
transform_data = {
installdir = platform;
name = gdb_grub;
common = gdb_grub.in;
};
script = {
transform_data = {
installdir = platform;
name = grub.chrp;
common = boot/powerpc/grub.chrp.in;
enable = powerpc_ieee1275;
};
script = {
transform_data = {
installdir = platform;
name = bootinfo.txt;
common = boot/powerpc/bootinfo.txt.in;
@ -59,14 +59,11 @@ kernel = {
ia64_efi_ldflags = '-Wl,-r,-d';
ia64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
x86_64_xen_cppflags = '$(CPPFLAGS_XEN)';
i386_xen_cppflags = '$(CPPFLAGS_XEN)';
arm_efi_ldflags = '-Wl,-r,-d';
arm_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
arm64_efi_ldflags = '-Wl,-r,-d';
arm64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
arm64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version -R .eh_frame';
i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x9000';
@ -83,8 +80,6 @@ kernel = {
x86_64_xen_ldflags = '$(TARGET_IMG_LDFLAGS)';
x86_64_xen_ldflags = '$(TARGET_IMG_BASE_LDOPT),0';
ldadd = '$(LDADD_KERNEL)';
mips_loongson_ldflags = '-Wl,-Ttext,0x80200000';
powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000';
sparc64_ieee1275_ldflags = '-Wl,-Ttext,0x4400';
@ -95,7 +90,7 @@ kernel = {
i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
emu_cflags = '$(CFLAGS_GNULIB)';
emu_cppflags = '$(CPPFLAGS_GNULIB)';
arm_uboot_ldflags = '-Wl,-Ttext=0x08000000';
arm_uboot_ldflags = '-Wl,-r,-d';
arm_uboot_stripflags = '--strip-unneeded -K start -R .note -R .comment -R .note.gnu.gold-version';
i386_pc_startup = kern/i386/pc/startup.S;
@ -132,6 +127,7 @@ kernel = {
common = kern/rescue_reader.c;
common = kern/term.c;
noemu = kern/compiler-rt.c;
noemu = kern/mm.c;
noemu = kern/time.c;
noemu = kern/generic/millisleep.c;
@ -159,6 +155,8 @@ kernel = {
terminfoinkernel = commands/extcmd.c;
terminfoinkernel = lib/arg.c;
softdiv = lib/division.c;
i386 = kern/i386/dl.c;
i386_xen = kern/i386/dl.c;
@ -173,8 +171,20 @@ kernel = {
efi = kern/efi/init.c;
efi = kern/efi/mm.c;
efi = term/efi/console.c;
efi = kern/acpi.c;
efi = kern/efi/acpi.c;
i386_coreboot = kern/i386/pc/acpi.c;
i386_multiboot = kern/i386/pc/acpi.c;
i386_coreboot = kern/acpi.c;
i386_multiboot = kern/acpi.c;
x86 = kern/i386/tsc.c;
x86 = kern/i386/tsc_pit.c;
i386_efi = kern/i386/efi/tsc.c;
x86_64_efi = kern/i386/efi/tsc.c;
i386_efi = kern/i386/tsc_pmtimer.c;
i386_coreboot = kern/i386/tsc_pmtimer.c;
x86_64_efi = kern/i386/tsc_pmtimer.c;
i386_efi = kern/i386/efi/init.c;
i386_efi = bus/pci.c;
@ -186,6 +196,7 @@ kernel = {
x86_64_efi = bus/pci.c;
xen = kern/i386/tsc.c;
xen = kern/i386/xen/tsc.c;
x86_64_xen = kern/x86_64/xen/hypercall.S;
i386_xen = kern/i386/xen/hypercall.S;
xen = kern/xen/init.c;
@ -202,7 +213,7 @@ kernel = {
arm_efi = kern/arm/efi/init.c;
arm_efi = kern/arm/efi/misc.c;
arm64_efi = kern/arm/efi/init.c;
arm64_efi = kern/arm64/efi/init.c;
i386_pc = kern/i386/pc/init.c;
i386_pc = kern/i386/pc/mmap.c;
@ -252,6 +263,7 @@ kernel = {
powerpc_ieee1275 = kern/powerpc/cache.S;
powerpc_ieee1275 = kern/powerpc/dl.c;
powerpc_ieee1275 = kern/powerpc/compiler-rt.S;
sparc64_ieee1275 = kern/sparc64/cache.S;
sparc64_ieee1275 = kern/sparc64/dl.c;
@ -263,7 +275,7 @@ kernel = {
arm = kern/arm/cache_armv7.S;
extra_dist = kern/arm/cache.S;
arm = kern/arm/cache.c;
arm = kern/arm/misc.S;
arm = kern/arm/compiler-rt.S;
arm64 = kern/arm64/cache.c;
arm64 = kern/arm64/cache_flush.S;
@ -441,13 +453,13 @@ image = {
common = lib/xzembed/xz_dec_bcj.c;
common = lib/xzembed/xz_dec_lzma2.c;
common = lib/xzembed/xz_dec_stream.c;
common = kern/compiler-rt.c;
cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -DGRUB_EMBED_DECOMPRESSOR=1';
objcopyflags = '-O binary';
mips_ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
ldadd = '$(TARGET_LIBGCC)';
cflags = '-Wno-unreachable-code $(TARGET_LDFLAGS_STATIC_LIBGCC)';
mips_ldflags = '-Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
cflags = '-Wno-unreachable-code';
enable = mips;
};
@ -459,9 +471,7 @@ image = {
cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1';
objcopyflags = '-O binary';
mips_ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) -Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
ldadd = '$(TARGET_LIBGCC)';
cflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC)';
mips_ldflags = '-Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
enable = mips;
};
@ -479,7 +489,7 @@ image = {
name = fwstart;
mips_loongson = boot/mips/loongson/fwstart.S;
objcopyflags = '-O binary';
ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) $(TARGET_LIBGCC) -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
ldflags = '-Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
enable = mips_loongson;
};
@ -487,7 +497,7 @@ image = {
name = fwstart_fuloong2f;
mips_loongson = boot/mips/loongson/fuloong2f.S;
objcopyflags = '-O binary';
ldflags = '$(TARGET_LDFLAGS_STATIC_LIBGCC) $(TARGET_LIBGCC) -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
ldflags = '-Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
enable = mips_loongson;
};
@ -509,13 +519,6 @@ module = {
enable = x86;
};
module = {
name = libusb;
emu = bus/usb/emu/usb.c;
enable = emu;
condition = COND_GRUB_EMU_USB;
};
module = {
name = lsspd;
mips_loongson = commands/mips/loongson/lsspd.c;
@ -530,13 +533,6 @@ module = {
enable = usb;
};
module = {
name = emuusb;
common = bus/usb/usb.c;
enable = emu;
condition = COND_GRUB_EMU_USB;
};
module = {
name = usbserial_common;
common = bus/usb/serial/common.c;
@ -618,7 +614,6 @@ module = {
module = {
name = lsxen;
common = commands/xen/lsxen.c;
cppflags = '$(CPPFLAGS_XEN)';
enable = xen;
};
@ -683,10 +678,8 @@ module = {
name = acpi;
common = commands/acpi.c;
efi = commands/efi/acpi.c;
i386_pc = commands/i386/pc/acpi.c;
i386_coreboot = commands/i386/pc/acpi.c;
i386_multiboot = commands/i386/pc/acpi.c;
i386_pc = kern/acpi.c;
i386_pc = kern/i386/pc/acpi.c;
enable = efi;
enable = i386_pc;
@ -839,7 +832,6 @@ module = {
i386_coreboot = lib/i386/halt.c;
i386_qemu = lib/i386/halt.c;
xen = lib/xen/halt.c;
xen_cppflags = '$(CPPFLAGS_XEN)';
efi = lib/efi/halt.c;
ieee1275 = lib/ieee1275/halt.c;
emu = lib/emu/halt.c;
@ -860,7 +852,6 @@ module = {
mips_loongson = lib/mips/loongson/reboot.c;
mips_qemu_mips = lib/mips/qemu_mips/reboot.c;
xen = lib/xen/reboot.c;
xen_cppflags = '$(CPPFLAGS_XEN)';
uboot = lib/uboot/reboot.c;
common = commands/reboot.c;
};
@ -1462,7 +1453,6 @@ module = {
module = {
name = gfxmenu;
common = gfxmenu/gfxmenu.c;
common = gfxmenu/model.c;
common = gfxmenu/view.c;
common = gfxmenu/font.c;
common = gfxmenu/icon_manager.c;
@ -1541,7 +1531,6 @@ module = {
i386_xen = lib/i386/xen/relocator.S;
x86_64_xen = lib/x86_64/xen/relocator.S;
xen = lib/i386/relocator_common_c.c;
xen_cppflags = '$(CPPFLAGS_XEN)';
extra_dist = lib/i386/relocator_common.S;
extra_dist = kern/powerpc/cache_flush.S;
@ -1562,7 +1551,6 @@ module = {
sparc64_ieee1275 = lib/ieee1275/cmos.c;
powerpc_ieee1275 = lib/ieee1275/cmos.c;
xen = lib/xen/datetime.c;
xen_cppflags = '$(CPPFLAGS_XEN)';
mips_arc = lib/arc/datetime.c;
enable = noemu;
@ -1661,11 +1649,17 @@ module = {
enable = x86;
};
module = {
name = xen_boot;
common = lib/cmdline.c;
arm64 = loader/arm64/xen_boot.c;
enable = arm64;
};
module = {
name = linux;
x86 = loader/i386/linux.c;
xen = loader/i386/xen.c;
xen_cppflags = '$(CPPFLAGS_XEN)';
i386_pc = lib/i386/pc/vesa_modes_table.c;
mips = loader/mips/linux.c;
powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
@ -1673,19 +1667,50 @@ module = {
ia64_efi = loader/ia64/efi/linux.c;
arm = loader/arm/linux.c;
arm64 = loader/arm64/linux.c;
fdt = lib/fdt.c;
common = loader/linux.c;
common = lib/cmdline.c;
enable = noemu;
};
module = {
name = fdt;
arm64 = loader/arm64/fdt.c;
common = lib/fdt.c;
enable = fdt;
};
module = {
name = xnu;
x86 = loader/xnu_resume.c;
x86 = loader/i386/xnu.c;
x86 = loader/xnu.c;
enable = x86;
/* Code is pretty generic but relies on RNG which
is available only on few platforms. It's not a
big deal as xnu needs ACPI anyway and we have
RNG on all platforms with ACPI.
*/
enable = i386_multiboot;
enable = i386_coreboot;
enable = i386_pc;
enable = i386_efi;
enable = x86_64_efi;
};
module = {
name = random;
x86 = lib/i386/random.c;
common = lib/random.c;
i386_multiboot = kern/i386/tsc_pmtimer.c;
i386_coreboot = kern/i386/tsc_pmtimer.c;
i386_pc = kern/i386/tsc_pmtimer.c;
enable = i386_multiboot;
enable = i386_coreboot;
enable = i386_pc;
enable = i386_efi;
enable = x86_64_efi;
};
module = {
@ -1969,11 +1994,42 @@ module = {
enable = xen;
};
module = {
name = div;
common = lib/division.c;
enable = no_softdiv;
};
module = {
name = div_test;
common = tests/div_test.c;
};
module = {
name = mul_test;
common = tests/mul_test.c;
};
module = {
name = shift_test;
common = tests/shift_test.c;
};
module = {
name = cmp_test;
common = tests/cmp_test.c;
};
module = {
name = ctz_test;
common = tests/ctz_test.c;
};
module = {
name = bswap_test;
common = tests/bswap_test.c;
};
module = {
name = videotest_checksum;
common = tests/videotest_checksum.c;

157
grub-core/Makefile.gcry.def Normal file
View File

@ -0,0 +1,157 @@
AutoGen definitions Makefile.tpl;
module = {
name = gcry_arcfour;
common = lib/libgcrypt-grub/cipher/arcfour.c;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_blowfish;
common = lib/libgcrypt-grub/cipher/blowfish.c;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_camellia;
common = lib/libgcrypt-grub/cipher/camellia-glue.c;
common = lib/libgcrypt-grub/cipher/camellia.c;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_cast5;
common = lib/libgcrypt-grub/cipher/cast5.c;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_crc;
common = lib/libgcrypt-grub/cipher/crc.c;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_des;
common = lib/libgcrypt-grub/cipher/des.c;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_dsa;
common = lib/libgcrypt-grub/cipher/dsa.c;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_idea;
common = lib/libgcrypt-grub/cipher/idea.c;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_md4;
common = lib/libgcrypt-grub/cipher/md4.c;
cflags = '$(CFLAGS_GCRY) -Wno-cast-align';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_md5;
common = lib/libgcrypt-grub/cipher/md5.c;
cflags = '$(CFLAGS_GCRY) -Wno-cast-align';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_rfc2268;
common = lib/libgcrypt-grub/cipher/rfc2268.c;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_rijndael;
common = lib/libgcrypt-grub/cipher/rijndael.c;
cflags = '$(CFLAGS_GCRY) -Wno-cast-align';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_rmd160;
common = lib/libgcrypt-grub/cipher/rmd160.c;
cflags = '$(CFLAGS_GCRY) -Wno-cast-align';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_rsa;
common = lib/libgcrypt-grub/cipher/rsa.c;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_seed;
common = lib/libgcrypt-grub/cipher/seed.c;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_serpent;
common = lib/libgcrypt-grub/cipher/serpent.c;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_sha1;
common = lib/libgcrypt-grub/cipher/sha1.c;
cflags = '$(CFLAGS_GCRY) -Wno-cast-align';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_sha256;
common = lib/libgcrypt-grub/cipher/sha256.c;
cflags = '$(CFLAGS_GCRY) -Wno-cast-align';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_sha512;
common = lib/libgcrypt-grub/cipher/sha512.c;
cflags = '$(CFLAGS_GCRY) -Wno-cast-align';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_tiger;
common = lib/libgcrypt-grub/cipher/tiger.c;
cflags = '$(CFLAGS_GCRY) -Wno-cast-align';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_twofish;
common = lib/libgcrypt-grub/cipher/twofish.c;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
};
module = {
name = gcry_whirlpool;
common = lib/libgcrypt-grub/cipher/whirlpool.c;
cflags = '$(CFLAGS_GCRY)';
cppflags = '$(CPPFLAGS_GCRY)';
};

42625
grub-core/Makefile.in Normal file

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@
#include <grub/decompressor.h>
void *
memset (void *s, int c, grub_size_t len)
grub_memset (void *s, int c, grub_size_t len)
{
grub_uint8_t *ptr;
for (ptr = s; len; ptr++, len--)
@ -68,15 +68,6 @@ grub_memcmp (const void *s1, const void *s2, grub_size_t n)
return 0;
}
int memcmp (const void *s1, const void *s2, grub_size_t n)
__attribute__ ((alias ("grub_memcmp")));
void *memmove (void *dest, const void *src, grub_size_t n)
__attribute__ ((alias ("grub_memmove")));
void *memcpy (void *dest, const void *src, grub_size_t n)
__attribute__ ((alias ("grub_memmove")));
void *grub_decompressor_scratch;
void

View File

@ -165,8 +165,8 @@ start:
* this area.
*/
. = _start + GRUB_BOOT_MACHINE_BPB_START
. = _start + 4
.org GRUB_BOOT_MACHINE_BPB_START
.org 4
#endif
#ifdef HYBRID_BOOT
floppy
@ -174,23 +174,23 @@ start:
scratch
#endif
. = _start + GRUB_BOOT_MACHINE_BPB_END
.org GRUB_BOOT_MACHINE_BPB_END
/*
* End of BIOS parameter block.
*/
kernel_address:
LOCAL(kernel_address):
.word GRUB_BOOT_MACHINE_KERNEL_ADDR
#ifndef HYBRID_BOOT
. = _start + GRUB_BOOT_MACHINE_KERNEL_SECTOR
kernel_sector:
.org GRUB_BOOT_MACHINE_KERNEL_SECTOR
LOCAL(kernel_sector):
.long 1
kernel_sector_high:
LOCAL(kernel_sector_high):
.long 0
#endif
. = _start + GRUB_BOOT_MACHINE_BOOT_DRIVE
.org GRUB_BOOT_MACHINE_BOOT_DRIVE
boot_drive:
.byte 0xff /* the disk to load kernel from */
/* 0xff means use the boot drive */
@ -208,7 +208,7 @@ LOCAL(after_BPB):
* possible boot drive. If GRUB is installed into a floppy,
* this does nothing (only jump).
*/
. = _start + GRUB_BOOT_MACHINE_DRIVE_CHECK
.org GRUB_BOOT_MACHINE_DRIVE_CHECK
boot_drive_check:
jmp 3f /* grub-setup may overwrite this jump */
testb $0x80, %dl
@ -275,7 +275,7 @@ real_start:
andw $1, %cx
jz LOCAL(chs_mode)
lba_mode:
LOCAL(lba_mode):
xorw %ax, %ax
movw %ax, 4(%si)
@ -290,9 +290,9 @@ lba_mode:
movw $0x0010, (%si)
/* the absolute address */
movl kernel_sector, %ebx
movl LOCAL(kernel_sector), %ebx
movl %ebx, 8(%si)
movl kernel_sector_high, %ebx
movl LOCAL(kernel_sector_high), %ebx
movl %ebx, 12(%si)
/* the segment of buffer address */
@ -361,13 +361,13 @@ LOCAL(final_init):
setup_sectors:
/* load logical sector start (top half) */
movl kernel_sector_high, %eax
movl LOCAL(kernel_sector_high), %eax
orl %eax, %eax
jnz LOCAL(geometry_error)
/* load logical sector start (bottom half) */
movl kernel_sector, %eax
movl LOCAL(kernel_sector), %eax
/* zero %edx */
xorl %edx, %edx
@ -452,7 +452,7 @@ LOCAL(copy_buffer):
popa
/* boot kernel */
jmp *(kernel_address)
jmp *(LOCAL(kernel_address))
/* END OF MAIN LOOP */
@ -511,13 +511,13 @@ LOCAL(message):
*/
#ifdef HYBRID_BOOT
. = _start + 0x1b0
kernel_sector:
.org 0x1b0
LOCAL(kernel_sector):
.long 1
kernel_sector_high:
LOCAL(kernel_sector_high):
.long 0
#endif
. = _start + GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC
.org GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC
nt_magic:
.long 0
.word 0
@ -528,7 +528,7 @@ nt_magic:
* sneaky, huh?
*/
. = _start + GRUB_BOOT_MACHINE_PART_START
.org GRUB_BOOT_MACHINE_PART_START
#ifndef HYBRID_BOOT
floppy
@ -536,7 +536,7 @@ nt_magic:
scratch
#endif
. = _start + GRUB_BOOT_MACHINE_PART_END
.org GRUB_BOOT_MACHINE_PART_END
/* the last 2 bytes in the sector 0 contain the signature */
.word GRUB_BOOT_MACHINE_SIGNATURE

View File

@ -43,7 +43,7 @@ _start:
LOCAL(next):
jmp 1f
. = start + 8
.org 8
bi_pvd:
.long 0 /* LBA of primary volume descriptor. */
@ -168,6 +168,6 @@ err_noboot_msg:
err_cdfail_msg:
.ascii "cdrom read fails\0"
. = start + 0x7FF
.org 0x7FF
.byte 0

View File

@ -362,7 +362,7 @@ LOCAL(message):
.word 0
.word 0
. = _start + 0x200 - GRUB_BOOT_MACHINE_LIST_SIZE
.org 0x200 - GRUB_BOOT_MACHINE_LIST_SIZE
LOCAL(firstlist): /* this label has to be before the first list entry!!! */
/* fill the first data listing with the default */
blocklist_default_start:

View File

@ -41,7 +41,7 @@ data_start:
xorl %ebp, %ebp
jmp LOCAL(linux_next)
. = data_start + 0x1F1
.org 0x1F1
setup_sects:
.byte CODE_SECTORS
@ -292,4 +292,4 @@ LOCAL(fail):
err_int15_msg:
.ascii "move memory fails\0"
. = _start + CODE_SECTORS * 512
.org (CODE_SECTORS * 512 + 512)

View File

@ -38,5 +38,5 @@ start:
/* This region is a junk. Do you say that this is wasteful?
But I like that the memory layout of the body is consistent
among different kernels rather than scamping just for 1.5KB. */
. = _start + 0x8200 - 0x7C00 - 0x200 - 1
.org 0x8200 - 0x7C00 - 0x200 - 1
.byte 0

View File

@ -50,23 +50,23 @@ LOCAL (base):
* This is a special data area.
*/
. = _start + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
.org GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
LOCAL(compressed_size):
.long 0
. = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
.org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
LOCAL(uncompressed_size):
.long 0
. = _start + GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY
.org GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY
reed_solomon_redundancy:
.long 0
. = _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_LENGTH
.org GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_LENGTH
.short (LOCAL(reed_solomon_part) - _start)
/*
* This is the area for all of the special variables.
*/
. = _start + GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE
.org GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE
LOCAL(boot_dev):
.byte 0xFF, 0xFF, 0xFF
LOCAL(boot_drive):
@ -89,13 +89,13 @@ LOCAL (codestart):
sti /* we're safe again */
/* save the boot drive */
ADDR32 movb %dl, LOCAL(boot_drive)
movb %dl, LOCAL(boot_drive)
/* reset disk system (%ah = 0) */
int $0x13
/* transition to protected mode */
DATA32 call real_to_prot
calll real_to_prot
/* The ".code32" directive takes GAS out of 16-bit mode. */
.code32
@ -149,7 +149,7 @@ gate_a20_try_bios:
movw $0x2401, %ax
int $0x15
DATA32 call real_to_prot
calll real_to_prot
.code32
popl %ebp

View File

@ -31,7 +31,7 @@ _start:
jmp 1f
. = _start + GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR
.org GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR
VARIABLE(grub_core_entry_addr)
.long 0
1:
@ -48,8 +48,9 @@ VARIABLE(grub_core_entry_addr)
/* Transition to protected mode. We use pushl to force generation
of a flat return address. */
pushl $1f
DATA32 jmp real_to_prot
jmp real_to_prot
.code32
1:
/* Ensure A20 is enabled. We're in qemu, so control port A works
and there is no need to wait since there is no real logic, it's
all emulated. */
@ -57,7 +58,6 @@ VARIABLE(grub_core_entry_addr)
andb $(~0x03), %al
orb $0x02, %al
outb $0x92
1:
movl EXT_C(grub_core_entry_addr), %edx
jmp *%edx
@ -66,9 +66,9 @@ VARIABLE(grub_core_entry_addr)
/* Intel, in its infinite wisdom, decided to put the i8086 entry point
*right here* and this is why we need this kludge. */
. = GRUB_BOOT_MACHINE_SIZE - 16
.org GRUB_BOOT_MACHINE_SIZE - 16
.code16
jmp _start
. = GRUB_BOOT_MACHINE_SIZE
.org GRUB_BOOT_MACHINE_SIZE

View File

@ -162,7 +162,7 @@ retry_cs5536:
b continue
. = start + GRUB_CPU_LOONGSON_FLASH_TLB_REFILL - GRUB_CPU_LOONGSON_FLASH_START
.org GRUB_CPU_LOONGSON_FLASH_TLB_REFILL - GRUB_CPU_LOONGSON_FLASH_START
tlb_refill:
mfc0 $s1, GRUB_CPU_LOONGSON_COP0_EPC
mfc0 $s2, GRUB_CPU_LOONGSON_COP0_BADVADDR
@ -196,13 +196,13 @@ tlb_refill:
b fatal
addiu $a0, $a0, %lo(unhandled_tlb_refill)
. = start + GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR - GRUB_CPU_LOONGSON_FLASH_START
.org GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR - GRUB_CPU_LOONGSON_FLASH_START
cache_error:
lui $a0, %hi(unhandled_cache_error)
b fatal
addiu $a0, $a0, %lo(unhandled_cache_error)
. = start + GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION - GRUB_CPU_LOONGSON_FLASH_START
.org GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION - GRUB_CPU_LOONGSON_FLASH_START
other_exception:
mfc0 $s0, GRUB_CPU_LOONGSON_COP0_CAUSE
mfc0 $s1, GRUB_CPU_LOONGSON_COP0_EPC
@ -344,7 +344,7 @@ printhex:
nop
srl $t1, $a0, 28
addiu $t1, $t1, -10
blt $t1, $zero, 2f
bltz $t1, 2f
sll $a0, $a0, 4
addiu $t1, $t1, 'A'-10-'0'
2: addiu $t1, $t1, '0'+10
@ -398,7 +398,7 @@ read_spd:
move $t2, $a0
move $t3, $ra
lui $a0, %hi(read_spd_fail)
addiu $a0, $a0, %hi(read_spd_fail)
addiu $a0, $a0, %lo(read_spd_fail)
/* Send START. */
lui $t0, %hi(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F)
@ -547,7 +547,7 @@ gpio_dump:
#endif
gpio_dump_end:
.p2align
.p2align 3
write_dumpreg:
ld $t2, 0($t6)

View File

@ -22,6 +22,7 @@
#include <grub/machine/memory.h>
#include <grub/machine/kernel.h>
#include <grub/offsets.h>
#include <grub/mips/asm.h>
#define BASE_ADDR 8
@ -39,13 +40,13 @@ start:
bal codestart
nop
base:
. = _start + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
.org GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
compressed_size:
.long 0
. = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
.org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
uncompressed_size:
.long 0
. = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR
.org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR
uncompressed_addr:
.long 0
codestart:
@ -118,50 +119,50 @@ parsestr:
move $v0, $zero
move $t3, $t1
3:
lb $t4, 0($t2)
lb $t5, 0($t3)
lb GRUB_ASM_T4, 0($t2)
lb GRUB_ASM_T5, 0($t3)
addiu $t2, $t2, 1
addiu $t3, $t3, 1
beq $t5, $zero, 1f
beq GRUB_ASM_T5, $zero, 1f
nop
beq $t5, $t4, 3b
beq GRUB_ASM_T5, GRUB_ASM_T4, 3b
nop
bne $t4, $zero, 1f
bne GRUB_ASM_T4, $zero, 1f
nop
addiu $t3, $t3, 0xffff
digcont:
lb $t5, 0($t3)
lb GRUB_ASM_T5, 0($t3)
/* Substract '0' from digit. */
addiu $t5, $t5, 0xffd0
bltz $t5, 1f
addiu GRUB_ASM_T5, GRUB_ASM_T5, 0xffd0
bltz GRUB_ASM_T5, 1f
nop
addiu $t4, $t5, 0xfff7
bgtz $t4, 1f
addiu GRUB_ASM_T4, GRUB_ASM_T5, 0xfff7
bgtz GRUB_ASM_T4, 1f
nop
/* Multiply $v0 by 10 with bitshifts. */
sll $v0, $v0, 1
sll $t4, $v0, 2
addu $v0, $v0, $t4
addu $v0, $v0, $t5
sll GRUB_ASM_T4, $v0, 2
addu $v0, $v0, GRUB_ASM_T4
addu $v0, $v0, GRUB_ASM_T5
addiu $t3, $t3, 1
b digcont
nop
1:
jr $ra
nop
busclockstr: .asciiz "busclock="
cpuclockstr: .asciiz "cpuclock="
memsizestr: .asciiz "memsize="
highmemsizestr: .asciiz "highmemsize="
machtype_yeeloong_str1: .asciiz "machtype=8.9"
machtype_yeeloong_str2: .asciiz "machtype=lemote-yeeloong-"
machtype_fuloong2f_str: .asciiz "machtype=lemote-fuloong-2f"
machtype_fuloong2e_str: .asciiz "machtype=lemote-fuloong-2e"
pmon_yeeloong_str: .asciiz "PMON_VER=LM8"
pmon_fuloong2f_str: .asciiz "PMON_VER=LM6"
pmon_yeeloong_verstr: .asciiz "Version=LM8"
pmon_fuloong2f_verstr: .asciiz "Version=LM6"
busclockstr: .asciz "busclock="
cpuclockstr: .asciz "cpuclock="
memsizestr: .asciz "memsize="
highmemsizestr: .asciz "highmemsize="
machtype_yeeloong_str1: .asciz "machtype=8.9"
machtype_yeeloong_str2: .asciz "machtype=lemote-yeeloong-"
machtype_fuloong2f_str: .asciz "machtype=lemote-fuloong-2f"
machtype_fuloong2e_str: .asciz "machtype=lemote-fuloong-2e"
pmon_yeeloong_str: .asciz "PMON_VER=LM8"
pmon_fuloong2f_str: .asciz "PMON_VER=LM6"
pmon_yeeloong_verstr: .asciz "Version=LM8"
pmon_fuloong2f_verstr: .asciz "Version=LM6"
.p2align 2
argdone:
@ -182,10 +183,10 @@ argdone:
b argdone
addiu $a1, $a1, 4
do_check:
lb $t4, 0($t7)
beq $t4, $zero, 1f
lb GRUB_ASM_T4, 0($t7)
beq GRUB_ASM_T4, $zero, 1f
lb $t3, 0($t6)
bne $t3, $t4, 2f
bne $t3, GRUB_ASM_T4, 2f
addiu $t6, $t6, 1
b do_check
addiu $t7, $t7, 1
@ -222,8 +223,8 @@ cmdlinedone:
1:
beq $t1, $t3, 2f
lb $t4, 0($t2)
sb $t4, 0($t1)
lb GRUB_ASM_T4, 0($t2)
sb GRUB_ASM_T4, 0($t1)
addiu $t1, $t1, 1
b 1b
addiu $t2, $t2, 1

View File

@ -41,9 +41,9 @@ pic_base:
* After loading in that block we will execute it by jumping to the
* load address plus the size of the prepended A.OUT header (32 bytes).
*/
. = _start + GRUB_BOOT_MACHINE_BOOT_DEVPATH
.org GRUB_BOOT_MACHINE_BOOT_DEVPATH
boot_path:
. = _start + GRUB_BOOT_MACHINE_KERNEL_BYTE
.org GRUB_BOOT_MACHINE_KERNEL_BYTE
boot_path_end:
kernel_byte: .xword (2 << 9)
kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR
@ -52,7 +52,7 @@ kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR
#define boot_path_end (_start + 1024)
#include <grub/offsets.h>
. = _start + 8
.org 8
kernel_byte: .xword (2 << 9)
kernel_size: .word 512
kernel_address: .word GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS
@ -224,7 +224,7 @@ bootpath_known:
#else
nop
#endif
. = _start + GRUB_BOOT_MACHINE_CODE_END
.org GRUB_BOOT_MACHINE_CODE_END
/* the last 4 bytes in the sector 0 contain the signature */
.word GRUB_BOOT_MACHINE_SIGNATURE

View File

@ -136,7 +136,7 @@ lastlist:
.word 0
.word 0
. = _start + (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE)
.org (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE)
blocklist_default_start:
.word 0
.word 2

View File

@ -55,7 +55,8 @@ grub_pci_device_map_range (grub_pci_device_t dev, grub_addr_t base,
int err;
err = pci_device_map_range (dev, base, size, PCI_DEV_MAP_FLAG_WRITABLE, &addr);
if (err)
grub_util_error ("mapping 0x%x failed (error %d)\n", base, err);
grub_util_error ("mapping 0x%llx failed (error %d)",
(unsigned long long) base, err);
return addr;
}
@ -66,12 +67,12 @@ grub_pci_device_unmap_range (grub_pci_device_t dev, void *mem,
pci_device_unmap_range (dev, mem, size);
}
GRUB_MOD_INIT (pci)
GRUB_MOD_INIT (emupci)
{
pci_system_init ();
}
GRUB_MOD_FINI (pci)
GRUB_MOD_FINI (emupci)
{
pci_system_cleanup ();
}

View File

@ -29,6 +29,7 @@
#include <grub/loader.h>
#include <grub/cs5536.h>
#include <grub/disk.h>
#include <grub/cache.h>
GRUB_MOD_LICENSE ("GPLv3+");
@ -337,6 +338,21 @@ struct grub_ehci
static struct grub_ehci *ehci;
static void
sync_all_caches (struct grub_ehci *e)
{
if (!e)
return;
if (e->td_virt)
grub_arch_sync_dma_caches (e->td_virt, sizeof (struct grub_ehci_td) *
GRUB_EHCI_N_TD);
if (e->qh_virt)
grub_arch_sync_dma_caches (e->qh_virt, sizeof (struct grub_ehci_qh) *
GRUB_EHCI_N_QH);
if (e->framelist_virt)
grub_arch_sync_dma_caches (e->framelist_virt, 4096);
}
/* EHCC registers access functions */
static inline grub_uint32_t
grub_ehci_ehcc_read32 (struct grub_ehci *e, grub_uint32_t addr)
@ -437,6 +453,8 @@ grub_ehci_reset (struct grub_ehci *e)
{
grub_uint64_t maxtime;
sync_all_caches (e);
grub_ehci_oper_write32 (e, GRUB_EHCI_COMMAND,
GRUB_EHCI_CMD_HC_RESET
| grub_ehci_oper_read32 (e, GRUB_EHCI_COMMAND));
@ -670,23 +688,23 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
for (i = 0; i < (GRUB_EHCI_N_TD - 1); i++)
{
e->td_virt[i].link_td = e->td_phys + (i + 1) * sizeof (struct grub_ehci_td);
e->td_virt[i].next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
e->td_virt[i].alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
e->td_virt[i].next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
e->td_virt[i].alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
}
e->td_virt[GRUB_EHCI_N_TD - 1].next_td =
grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
e->td_virt[GRUB_EHCI_N_TD - 1].alt_next_td =
grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
e->tdfree_virt = e->td_virt;
/* Set Terminate in first QH, which is used in framelist */
e->qh_virt[0].qh_hptr = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE | GRUB_EHCI_HPTR_TYPE_QH);
e->qh_virt[0].td_overlay.next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
e->qh_virt[0].qh_hptr = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE | GRUB_EHCI_HPTR_TYPE_QH);
e->qh_virt[0].td_overlay.next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
e->qh_virt[0].td_overlay.alt_next_td =
grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
/* Also set Halted bit in token */
e->qh_virt[0].td_overlay.token = grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED);
e->qh_virt[0].td_overlay.token = grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED);
/* Set the H bit in first QH used for AL */
e->qh_virt[1].ep_char = grub_cpu_to_le32 (GRUB_EHCI_H);
e->qh_virt[1].ep_char = grub_cpu_to_le32_compile_time (GRUB_EHCI_H);
/* Set Terminate into TD in rest of QHs and set horizontal link
* pointer to itself - these QHs will be used for asynchronous
* schedule and they should have valid value in horiz. link */
@ -697,12 +715,12 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
e->qh_chunk) &
GRUB_EHCI_POINTER_MASK) | GRUB_EHCI_HPTR_TYPE_QH);
e->qh_virt[i].td_overlay.next_td =
grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
e->qh_virt[i].td_overlay.alt_next_td =
grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
/* Also set Halted bit in token */
e->qh_virt[i].td_overlay.token =
grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED);
grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED);
}
/* Note: QH 0 and QH 1 are reserved and must not be used anywhere.
@ -840,6 +858,8 @@ grub_ehci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
e->next = ehci;
ehci = e;
sync_all_caches (e);
grub_dprintf ("ehci", "EHCI grub_ehci_pci_iter: OK at all\n");
grub_dprintf ("ehci",
@ -991,7 +1011,7 @@ grub_ehci_find_qh (struct grub_ehci *e, grub_usb_transfer_t transfer)
target = ((transfer->endpoint << GRUB_EHCI_EP_NUM_OFF) |
transfer->devaddr) & GRUB_EHCI_TARGET_MASK;
target = grub_cpu_to_le32 (target);
mask = grub_cpu_to_le32 (GRUB_EHCI_TARGET_MASK);
mask = grub_cpu_to_le32_compile_time (GRUB_EHCI_TARGET_MASK);
/* low speed interrupt transfers are linked to the periodic */
/* schedule, everything else to the asynchronous schedule */
@ -1020,6 +1040,7 @@ grub_ehci_find_qh (struct grub_ehci *e, grub_usb_transfer_t transfer)
/* Found proper existing (and linked) QH, do setup of QH */
grub_dprintf ("ehci", "find_qh: found, QH=%p\n", qh_iter);
grub_ehci_setup_qh (qh_iter, transfer);
sync_all_caches (e);
return qh_iter;
}
@ -1121,7 +1142,7 @@ grub_ehci_free_tds (struct grub_ehci *e, grub_ehci_td_t td,
token = grub_le_to_cpu32 (td->token);
to_transfer = (token & GRUB_EHCI_TOTAL_MASK) >> GRUB_EHCI_TOTAL_OFF;
/* Check state of TD - if it did not transfered
/* Check state of TD - if it did not transfer
* whole data then set last_trans - it should be last executed TD
* in case when something went wrong. */
if (transfer && (td->size != to_transfer))
@ -1200,7 +1221,7 @@ grub_ehci_transaction (struct grub_ehci *e,
grub_memset ((void *) td, 0, sizeof (struct grub_ehci_td));
/* Don't point to any TD yet, just terminate. */
td->next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
td->next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
/* Set alternate pointer. When short packet occurs, alternate TD
* will not be really fetched because it is not active. But don't
* forget, EHCI will try to fetch alternate TD every scan of AL
@ -1289,16 +1310,28 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
grub_ehci_td_t td_prev = NULL;
int i;
struct grub_ehci_transfer_controller_data *cdata;
grub_uint32_t status;
sync_all_caches (e);
/* Check if EHCI is running and AL is enabled */
if ((grub_ehci_oper_read32 (e, GRUB_EHCI_STATUS)
& GRUB_EHCI_ST_HC_HALTED) != 0)
status = grub_ehci_oper_read32 (e, GRUB_EHCI_STATUS);
if ((status & GRUB_EHCI_ST_HC_HALTED) != 0)
/* XXX: Fix it: Currently we don't do anything to restart EHCI */
return GRUB_USB_ERR_INTERNAL;
if ((grub_ehci_oper_read32 (e, GRUB_EHCI_STATUS)
{
grub_dprintf ("ehci", "setup_transfer: halted, status = 0x%x\n",
status);
return GRUB_USB_ERR_INTERNAL;
}
status = grub_ehci_oper_read32 (e, GRUB_EHCI_STATUS);
if ((status
& (GRUB_EHCI_ST_AS_STATUS | GRUB_EHCI_ST_PS_STATUS)) == 0)
/* XXX: Fix it: Currently we don't do anything to restart EHCI */
return GRUB_USB_ERR_INTERNAL;
{
grub_dprintf ("ehci", "setup_transfer: no AS/PS, status = 0x%x\n",
status);
return GRUB_USB_ERR_INTERNAL;
}
/* Allocate memory for controller transfer data. */
cdata = grub_malloc (sizeof (*cdata));
@ -1310,6 +1343,7 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
cdata->qh_virt = grub_ehci_find_qh (e, transfer);
if (!cdata->qh_virt)
{
grub_dprintf ("ehci", "setup_transfer: no QH\n");
grub_free (cdata);
return GRUB_USB_ERR_INTERNAL;
}
@ -1319,15 +1353,16 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
cdata->td_alt_virt = grub_ehci_alloc_td (e);
if (!cdata->td_alt_virt)
{
grub_dprintf ("ehci", "setup_transfer: no TDs\n");
grub_free (cdata);
return GRUB_USB_ERR_INTERNAL;
}
/* Fill whole alternate TD by zeros (= inactive) and set
* Terminate bits and Halt bit */
grub_memset ((void *) cdata->td_alt_virt, 0, sizeof (struct grub_ehci_td));
cdata->td_alt_virt->next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
cdata->td_alt_virt->alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
cdata->td_alt_virt->token = grub_cpu_to_le32 (GRUB_EHCI_STATUS_HALTED);
cdata->td_alt_virt->next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
cdata->td_alt_virt->alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
cdata->td_alt_virt->token = grub_cpu_to_le32_compile_time (GRUB_EHCI_STATUS_HALTED);
/* Allocate appropriate number of TDs and set */
for (i = 0; i < transfer->transcnt; i++)
@ -1345,6 +1380,7 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
grub_ehci_free_tds (e, cdata->td_first_virt, NULL, &actual);
grub_free (cdata);
grub_dprintf ("ehci", "setup_transfer: no TD\n");
return GRUB_USB_ERR_INTERNAL;
}
@ -1364,7 +1400,7 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
cdata->td_last_virt = td;
cdata->td_last_phys = grub_dma_virt2phys (td, e->td_chunk);
/* Last TD should not have set alternate TD */
cdata->td_last_virt->alt_next_td = grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
cdata->td_last_virt->alt_next_td = grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
grub_dprintf ("ehci", "setup_transfer: cdata=%p, qh=%p\n",
cdata,cdata->qh_virt);
@ -1377,14 +1413,16 @@ grub_ehci_setup_transfer (grub_usb_controller_t dev,
/* Start transfer: */
/* Unlink possible alternate pointer in QH */
cdata->qh_virt->td_overlay.alt_next_td =
grub_cpu_to_le32 (GRUB_EHCI_TERMINATE);
grub_cpu_to_le32_compile_time (GRUB_EHCI_TERMINATE);
/* Link new TDs with QH via next_td */
cdata->qh_virt->td_overlay.next_td =
grub_cpu_to_le32 (grub_dma_virt2phys
(cdata->td_first_virt, e->td_chunk));
/* Reset Active and Halted bits in QH to activate Advance Queue,
* i.e. reset token */
cdata->qh_virt->td_overlay.token = grub_cpu_to_le32 (0);
cdata->qh_virt->td_overlay.token = grub_cpu_to_le32_compile_time (0);
sync_all_caches (e);
/* Finito */
transfer->controller_data = cdata;
@ -1408,9 +1446,9 @@ grub_ehci_pre_finish_transfer (grub_usb_transfer_t transfer)
* safely manipulate with QH TD part. */
cdata->qh_virt->td_overlay.token = (cdata->qh_virt->td_overlay.token
|
grub_cpu_to_le32
grub_cpu_to_le32_compile_time
(GRUB_EHCI_STATUS_HALTED)) &
grub_cpu_to_le32 (~GRUB_EHCI_STATUS_ACTIVE);
grub_cpu_to_le32_compile_time (~GRUB_EHCI_STATUS_ACTIVE);
/* Print debug data here if necessary */
@ -1434,6 +1472,8 @@ grub_ehci_parse_notrun (grub_usb_controller_t dev,
grub_ehci_free_td (e, cdata->td_alt_virt);
grub_free (cdata);
sync_all_caches (e);
/* Additionally, do something with EHCI to make it running (what?) */
/* Try enable EHCI and AL */
grub_ehci_oper_write32 (e, GRUB_EHCI_COMMAND,
@ -1469,6 +1509,8 @@ grub_ehci_parse_halt (grub_usb_controller_t dev,
grub_ehci_free_td (e, cdata->td_alt_virt);
grub_free (cdata);
sync_all_caches (e);
/* Evaluation of error code - currently we don't have GRUB USB error
* codes for some EHCI states, GRUB_USB_ERR_DATA is used for them.
* Order of evaluation is critical, specially bubble/stall. */
@ -1502,6 +1544,8 @@ grub_ehci_parse_success (grub_usb_controller_t dev,
grub_ehci_free_td (e, cdata->td_alt_virt);
grub_free (cdata);
sync_all_caches (e);
return GRUB_USB_ERR_NONE;
}
@ -1515,6 +1559,8 @@ grub_ehci_check_transfer (grub_usb_controller_t dev,
transfer->controller_data;
grub_uint32_t token, token_ftd;
sync_all_caches (e);
grub_dprintf ("ehci",
"check_transfer: EHCI STATUS=%08x, cdata=%p, qh=%p\n",
grub_ehci_oper_read32 (e, GRUB_EHCI_STATUS),
@ -1581,6 +1627,9 @@ grub_ehci_cancel_transfer (grub_usb_controller_t dev,
int i;
grub_uint64_t maxtime;
grub_uint32_t qh_phys;
sync_all_caches (e);
grub_uint32_t interrupt =
cdata->qh_virt->ep_cap & GRUB_EHCI_SMASK_MASK;
@ -1600,6 +1649,7 @@ grub_ehci_cancel_transfer (grub_usb_controller_t dev,
grub_ehci_free_tds (e, cdata->td_first_virt, transfer, &actual);
grub_ehci_free_td (e, cdata->td_alt_virt);
grub_free (cdata);
sync_all_caches (e);
grub_dprintf ("ehci", "cancel_transfer: end - EHCI not running\n");
return GRUB_USB_ERR_NONE;
}
@ -1622,6 +1672,8 @@ grub_ehci_cancel_transfer (grub_usb_controller_t dev,
/* Unlink QH from AL */
e->qh_virt[i].qh_hptr = cdata->qh_virt->qh_hptr;
sync_all_caches (e);
/* If this is an interrupt transfer, we just wait for the periodic
* schedule to advance a few times and then assume that the EHCI
* controller has read the updated QH. */
@ -1676,6 +1728,8 @@ grub_ehci_cancel_transfer (grub_usb_controller_t dev,
grub_dprintf ("ehci", "cancel_transfer: end\n");
sync_all_caches (e);
return GRUB_USB_ERR_NONE;
}
@ -1777,11 +1831,6 @@ grub_ehci_detect_dev (grub_usb_controller_t dev, int port, int *changed)
status = grub_ehci_port_read (e, port);
grub_dprintf ("ehci", "detect_dev: EHCI STATUS: %08x\n",
grub_ehci_oper_read32 (e, GRUB_EHCI_STATUS));
grub_dprintf ("ehci", "detect_dev: iobase=%p, port=%d, status=0x%02x\n",
e->iobase, port, status);
/* Connect Status Change bit - it detects change of connection */
if (status & GRUB_EHCI_PORT_CONNECT_CH)
{

View File

@ -1,203 +0,0 @@
/* usb.c -- libusb USB support for GRUB. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008 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 <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <usb.h>
#include <grub/usb.h>
#include <grub/dl.h>
GRUB_MOD_LICENSE ("GPLv3+");
static struct grub_usb_controller_dev usb_controller =
{
.name = "libusb"
};
static struct grub_usb_device *grub_usb_devs[128];
struct usb_bus *busses;
static grub_err_t
grub_libusb_devices (void)
{
struct usb_bus *bus;
int last = 0;
busses = usb_get_busses();
for (bus = busses; bus; bus = bus->next)
{
struct usb_device *usbdev;
struct grub_usb_device *dev;
for (usbdev = bus->devices; usbdev; usbdev = usbdev->next)
{
struct usb_device_descriptor *desc = &usbdev->descriptor;
grub_err_t err;
if (! desc->bcdUSB)
continue;
dev = grub_malloc (sizeof (*dev));
if (! dev)
return grub_errno;
dev->data = usbdev;
/* Fill in all descriptors. */
err = grub_usb_device_initialize (dev);
if (err)
{
grub_errno = GRUB_ERR_NONE;
continue;
}
/* Register the device. */
grub_usb_devs[last++] = dev;
}
}
return GRUB_USB_ERR_NONE;
}
void
grub_usb_poll_devices (void)
{
/* TODO: recheck grub_usb_devs */
}
int
grub_usb_iterate (grub_usb_iterate_hook_t hook, void *hook_data)
{
int i;
for (i = 0; i < 128; i++)
{
if (grub_usb_devs[i])
{
if (hook (grub_usb_devs[i], hook_data))
return 1;
}
}
return 0;
}
grub_usb_err_t
grub_usb_root_hub (grub_usb_controller_t controller __attribute__((unused)))
{
return GRUB_USB_ERR_NONE;
}
grub_usb_err_t
grub_usb_control_msg (grub_usb_device_t dev, grub_uint8_t reqtype,
grub_uint8_t request, grub_uint16_t value,
grub_uint16_t idx, grub_size_t size, char *data)
{
usb_dev_handle *devh;
struct usb_device *d = dev->data;
devh = usb_open (d);
if (usb_control_msg (devh, reqtype, request,
value, idx, data, size, 20) < 0)
{
usb_close (devh);
return GRUB_USB_ERR_STALL;
}
usb_close (devh);
return GRUB_USB_ERR_NONE;
}
grub_usb_err_t
grub_usb_bulk_read (grub_usb_device_t dev,
int endpoint, grub_size_t size, char *data)
{
usb_dev_handle *devh;
struct usb_device *d = dev->data;
devh = usb_open (d);
if (usb_claim_interface (devh, 0) < 1)
{
usb_close (devh);
return GRUB_USB_ERR_STALL;
}
if (usb_bulk_read (devh, endpoint, data, size, 20) < 1)
{
usb_close (devh);
return GRUB_USB_ERR_STALL;
}
usb_release_interface (devh, 0);
usb_close (devh);
return GRUB_USB_ERR_NONE;
}
grub_usb_err_t
grub_usb_bulk_write (grub_usb_device_t dev,
int endpoint, grub_size_t size, char *data)
{
usb_dev_handle *devh;
struct usb_device *d = dev->data;
devh = usb_open (d);
if (usb_claim_interface (devh, 0) < 0)
goto fail;
if (usb_bulk_write (devh, endpoint, data, size, 20) < 0)
goto fail;
if (usb_release_interface (devh, 0) < 0)
goto fail;
usb_close (devh);
return GRUB_USB_ERR_NONE;
fail:
usb_close (devh);
return GRUB_USB_ERR_STALL;
}
GRUB_MOD_INIT (libusb)
{
usb_init();
usb_find_busses();
usb_find_devices();
if (grub_libusb_devices ())
return;
grub_usb_controller_dev_register (&usb_controller);
return;
}
GRUB_MOD_FINI (libusb)
{
return;
}

View File

@ -314,7 +314,7 @@ grub_ohci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
grub_memset ((void *) o->ed_ctrl, 0, sizeof (struct grub_ohci_ed)
* GRUB_OHCI_CTRL_EDS);
for (j=0; j < GRUB_OHCI_CTRL_EDS; j++)
o->ed_ctrl[j].target = grub_cpu_to_le32 (1 << 14); /* skip */
o->ed_ctrl[j].target = grub_cpu_to_le32_compile_time (1 << 14); /* skip */
grub_dprintf ("ohci", "EDs-C: chunk=%p, virt=%p, phys=0x%02x\n",
o->ed_ctrl_chunk, o->ed_ctrl, o->ed_ctrl_addr);
@ -329,7 +329,7 @@ grub_ohci_pci_iter (grub_pci_device_t dev, grub_pci_id_t pciid,
/* Preset EDs */
grub_memset ((void*)o->ed_bulk, 0, sizeof(struct grub_ohci_ed) * GRUB_OHCI_BULK_EDS);
for (j=0; j < GRUB_OHCI_BULK_EDS; j++)
o->ed_bulk[j].target = grub_cpu_to_le32 (1 << 14); /* skip */
o->ed_bulk[j].target = grub_cpu_to_le32_compile_time (1 << 14); /* skip */
grub_dprintf ("ohci", "EDs-B: chunk=%p, virt=%p, phys=0x%02x\n",
o->ed_bulk_chunk, o->ed_bulk, o->ed_bulk_addr);
@ -750,7 +750,10 @@ grub_ohci_setup_transfer (grub_usb_controller_t dev,
{
cdata->td_head_virt = grub_ohci_alloc_td (o);
if (!cdata->td_head_virt)
return GRUB_USB_ERR_INTERNAL; /* We don't need de-allocate ED */
{
grub_free (cdata);
return GRUB_USB_ERR_INTERNAL; /* We don't need de-allocate ED */
}
/* We can set td_head only when ED is not active, i.e.
* when it is newly allocated. */
cdata->ed_virt->td_head
@ -1349,10 +1352,10 @@ grub_ohci_fini_hw (int noreturn __attribute__ ((unused)))
/* Set skip in all EDs */
if (o->ed_bulk)
for (i=0; i < GRUB_OHCI_BULK_EDS; i++)
o->ed_bulk[i].target |= grub_cpu_to_le32 (1 << 14); /* skip */
o->ed_bulk[i].target |= grub_cpu_to_le32_compile_time (1 << 14); /* skip */
if (o->ed_ctrl)
for (i=0; i < GRUB_OHCI_CTRL_EDS; i++)
o->ed_ctrl[i].target |= grub_cpu_to_le32 (1 << 14); /* skip */
o->ed_ctrl[i].target |= grub_cpu_to_le32_compile_time (1 << 14); /* skip */
/* We should wait for next SOF to be sure that all EDs are
* unaccessed by OHCI. But OHCI can be non-functional, so

View File

@ -625,9 +625,7 @@ grub_uhci_check_transfer (grub_usb_controller_t dev,
return GRUB_USB_ERR_NONE;
}
grub_dprintf ("uhci", "t status=0x%02x\n", errtd->ctrl_status);
if (!(errtd->ctrl_status & (1 << 23)))
if (errtd && !(errtd->ctrl_status & (1 << 23)))
{
grub_usb_err_t err = GRUB_USB_ERR_NONE;

View File

@ -24,6 +24,7 @@
#include <grub/usb.h>
#include <grub/usbtrans.h>
#include <grub/time.h>
#include <grub/cache.h>
static inline unsigned int
@ -31,7 +32,7 @@ grub_usb_bulk_maxpacket (grub_usb_device_t dev,
struct grub_usb_desc_endp *endpoint)
{
/* Use the maximum packet size given in the endpoint descriptor. */
if (dev->initialized && endpoint)
if (dev->initialized && endpoint && (unsigned int) endpoint->maxpacket)
return endpoint->maxpacket;
return 64;
@ -101,6 +102,8 @@ grub_usb_control_msg (grub_usb_device_t dev,
data_addr = grub_dma_get_phys (data_chunk);
grub_memcpy ((char *) data, data_in, size);
grub_arch_sync_dma_caches (data, size);
grub_dprintf ("usb",
"control: reqtype=0x%02x req=0x%02x val=0x%02x idx=0x%02x size=%lu\n",
reqtype, request, value, index, (unsigned long)size);
@ -161,6 +164,8 @@ grub_usb_control_msg (grub_usb_device_t dev,
setupdata->value = value;
setupdata->index = index;
setupdata->length = size;
grub_arch_sync_dma_caches (setupdata, sizeof (*setupdata));
transfer->transactions[0].size = sizeof (*setupdata);
transfer->transactions[0].pid = GRUB_USB_TRANSFER_TYPE_SETUP;
transfer->transactions[0].data = setupdata_addr;
@ -202,11 +207,13 @@ grub_usb_control_msg (grub_usb_device_t dev,
grub_free (transfer->transactions);
grub_free (transfer);
grub_dma_free (data_chunk);
grub_dma_free (setupdata_chunk);
grub_arch_sync_dma_caches (data, size0);
grub_memcpy (data_in, (char *) data, size0);
grub_dma_free (data_chunk);
return err;
}
@ -236,7 +243,10 @@ grub_usb_bulk_setup_readwrite (grub_usb_device_t dev,
data = grub_dma_get_virt (data_chunk);
data_addr = grub_dma_get_phys (data_chunk);
if (type == GRUB_USB_TRANSFER_TYPE_OUT)
grub_memcpy ((char *) data, data_in, size);
{
grub_memcpy ((char *) data, data_in, size);
grub_arch_sync_dma_caches (data, size);
}
/* Create a transfer. */
transfer = grub_malloc (sizeof (struct grub_usb_transfer));
@ -306,13 +316,17 @@ grub_usb_bulk_finish_readwrite (grub_usb_transfer_t transfer)
dev->toggle[transfer->endpoint] = toggle;
if (transfer->dir == GRUB_USB_TRANSFER_TYPE_IN)
grub_memcpy (transfer->data, (void *)
grub_dma_get_virt (transfer->data_chunk),
transfer->size + 1);
{
grub_arch_sync_dma_caches (grub_dma_get_virt (transfer->data_chunk),
transfer->size + 1);
grub_memcpy (transfer->data, (void *)
grub_dma_get_virt (transfer->data_chunk),
transfer->size + 1);
}
grub_free (transfer->transactions);
grub_free (transfer);
grub_dma_free (transfer->data_chunk);
grub_free (transfer);
}
static grub_usb_err_t

View File

@ -61,18 +61,6 @@ static const struct grub_arg_option options[] = {
{0, 0, 0, 0, 0, 0}
};
/* Simple checksum by summing all bytes. Used by ACPI and SMBIOS. */
grub_uint8_t
grub_byte_checksum (void *base, grub_size_t size)
{
grub_uint8_t *ptr;
grub_uint8_t ret = 0;
for (ptr = (grub_uint8_t *) base; ptr < ((grub_uint8_t *) base) + size;
ptr++)
ret += *ptr;
return ret;
}
/* rev1 is 1 if ACPIv1 is to be generated, 0 otherwise.
rev2 contains the revision of ACPIv2+ to generate or 0 if none. */
static int rev1, rev2;
@ -131,6 +119,8 @@ grub_acpi_get_rsdpv1 (void)
return grub_machine_acpi_get_rsdpv1 ();
}
#if defined (__i386__) || defined (__x86_64__)
static inline int
iszero (grub_uint8_t *reg, int size)
{
@ -141,7 +131,6 @@ iszero (grub_uint8_t *reg, int size)
return 1;
}
#if defined (__i386__) || defined (__x86_64__)
/* Context for grub_acpi_create_ebda. */
struct grub_acpi_create_ebda_ctx {
int ebda_len;
@ -179,8 +168,10 @@ grub_acpi_create_ebda (void)
struct grub_acpi_rsdp_v20 *v2;
ebda = (grub_uint8_t *) (grub_addr_t) ((*((grub_uint16_t *)0x40e)) << 4);
grub_dprintf ("acpi", "EBDA @%p\n", ebda);
if (ebda)
ebda_kb_len = *(grub_uint16_t *) ebda;
grub_dprintf ("acpi", "EBDA length 0x%x\n", ebda_kb_len);
if (ebda_kb_len > 16)
ebda_kb_len = 0;
ctx.ebda_len = (ebda_kb_len + 1) << 10;
@ -227,7 +218,7 @@ grub_acpi_create_ebda (void)
grub_dprintf ("acpi", "Copying rsdpv2 to %p\n", target);
v2inebda = target;
target += v2->length;
target = (grub_uint8_t *) ((((grub_addr_t) target - 1) | 0xf) + 1);
target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16);
v2 = 0;
break;
}
@ -246,7 +237,7 @@ grub_acpi_create_ebda (void)
grub_dprintf ("acpi", "Copying rsdpv1 to %p\n", target);
v1inebda = target;
target += sizeof (struct grub_acpi_rsdp_v10);
target = (grub_uint8_t *) ((((grub_addr_t) target - 1) | 0xf) + 1);
target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16);
v1 = 0;
break;
}
@ -265,7 +256,7 @@ grub_acpi_create_ebda (void)
grub_memcpy (target, v2, v2->length);
v2inebda = target;
target += v2->length;
target = (grub_uint8_t *) ((((grub_addr_t) target - 1) | 0xf) + 1);
target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16);
v2 = 0;
break;
}
@ -282,7 +273,7 @@ grub_acpi_create_ebda (void)
grub_memcpy (target, v1, sizeof (struct grub_acpi_rsdp_v10));
v1inebda = target;
target += sizeof (struct grub_acpi_rsdp_v10);
target = (grub_uint8_t *) ((((grub_addr_t) target - 1) | 0xf) + 1);
target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16);
v1 = 0;
break;
}
@ -494,6 +485,8 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
if (! rsdp)
rsdp = grub_machine_acpi_get_rsdpv1 ();
grub_dprintf ("acpi", "RSDP @%p\n", rsdp);
if (rsdp)
{
grub_uint32_t *entry_ptr;
@ -600,6 +593,9 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
if (! table->addr)
{
free_tables ();
grub_free (exclude);
grub_free (load_only);
grub_free (table);
return grub_errno;
}
table->next = acpi_tables;

View File

@ -26,6 +26,8 @@
#define grub_dprintf(cond, args...) printf ( args )
#define grub_printf printf
#define grub_util_fopen fopen
#define grub_memcmp memcmp
typedef uint64_t grub_uint64_t;
typedef uint32_t grub_uint32_t;
typedef uint16_t grub_uint16_t;
@ -135,6 +137,49 @@ skip_data_ref_object (const grub_uint8_t *ptr, const grub_uint8_t *end)
}
}
static inline grub_uint32_t
skip_term (const grub_uint8_t *ptr, const grub_uint8_t *end)
{
grub_uint32_t add;
const grub_uint8_t *ptr0 = ptr;
switch(*ptr)
{
case GRUB_ACPI_OPCODE_ADD:
case GRUB_ACPI_OPCODE_AND:
case GRUB_ACPI_OPCODE_CONCAT:
case GRUB_ACPI_OPCODE_CONCATRES:
case GRUB_ACPI_OPCODE_DIVIDE:
case GRUB_ACPI_OPCODE_INDEX:
case GRUB_ACPI_OPCODE_LSHIFT:
case GRUB_ACPI_OPCODE_MOD:
case GRUB_ACPI_OPCODE_MULTIPLY:
case GRUB_ACPI_OPCODE_NAND:
case GRUB_ACPI_OPCODE_NOR:
case GRUB_ACPI_OPCODE_OR:
case GRUB_ACPI_OPCODE_RSHIFT:
case GRUB_ACPI_OPCODE_SUBTRACT:
case GRUB_ACPI_OPCODE_TOSTRING:
case GRUB_ACPI_OPCODE_XOR:
/*
* Parameters for these opcodes: TermArg, TermArg Target, see ACPI
* spec r5.0, page 828f.
*/
ptr++;
ptr += add = skip_term (ptr, end);
if (!add)
return 0;
ptr += add = skip_term (ptr, end);
if (!add)
return 0;
ptr += skip_name_string (ptr, end);
break;
default:
return skip_data_ref_object (ptr, end);
}
return ptr - ptr0;
}
static inline grub_uint32_t
skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end)
{
@ -156,10 +201,10 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end)
ptr++;
ptr += skip_name_string (ptr, end);
ptr++;
ptr += add = skip_data_ref_object (ptr, end);
ptr += add = skip_term (ptr, end);
if (!add)
return 0;
ptr += add = skip_data_ref_object (ptr, end);
ptr += add = skip_term (ptr, end);
if (!add)
return 0;
break;
@ -180,6 +225,7 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end)
return ptr - ptr0;
}
static int
get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
grub_uint8_t *scope, int scope_len)
@ -202,6 +248,7 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
if (!add)
return -1;
break;
case GRUB_ACPI_OPCODE_CREATE_DWORD_FIELD:
case GRUB_ACPI_OPCODE_CREATE_WORD_FIELD:
case GRUB_ACPI_OPCODE_CREATE_BYTE_FIELD:
{
@ -214,8 +261,8 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
}
case GRUB_ACPI_OPCODE_NAME:
ptr++;
if ((!scope || memcmp (scope, "\\", scope_len) == 0) &&
(memcmp (ptr, "_S5_", 4) == 0 || memcmp (ptr, "\\_S5_", 4) == 0))
if ((!scope || grub_memcmp (scope, "\\", scope_len) == 0) &&
(grub_memcmp (ptr, "_S5_", 4) == 0 || grub_memcmp (ptr, "\\_S5_", 4) == 0))
{
int ll;
grub_uint8_t *ptr2 = ptr;
@ -250,6 +297,17 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
if (!add)
return -1;
break;
case GRUB_ACPI_OPCODE_ALIAS:
ptr++;
/* We need to skip two name strings */
ptr += add = skip_name_string (ptr, end);
if (!add)
return -1;
ptr += add = skip_name_string (ptr, end);
if (!add)
return -1;
break;
case GRUB_ACPI_OPCODE_SCOPE:
{
int scope_sleep_type;

View File

@ -23,6 +23,8 @@
#include <grub/i18n.h>
#include <grub/disk.h>
GRUB_MOD_LICENSE ("GPLv3+");
static grub_err_t
grub_rescue_cmd_info (struct grub_command *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)),

View File

@ -140,10 +140,13 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
}
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
for (j = 0; j < utcount; j++)
grub_printf ("<%x>", (unsigned int) utbuf[j]);
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
if (utcount)
{
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
for (j = 0; j < utcount; j++)
grub_printf ("<%x>", (unsigned int) utbuf[j]);
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
}
grub_xputs ("\n");
grub_refresh ();

View File

@ -51,7 +51,7 @@ grub_cmd_lsefimmap (grub_command_t cmd __attribute__ ((unused)),
grub_printf
("Type Physical start - end #Pages "
" Size Attributes\n");
" Size Attributes\n");
memory_map_end = ADD_MEMORY_DESCRIPTOR (memory_map, map_size);
for (desc = memory_map;
desc < memory_map_end;
@ -74,7 +74,8 @@ grub_cmd_lsefimmap (grub_command_t cmd __attribute__ ((unused)),
"ACPI-nvs",
"MMIO ",
"IO-ports",
"PAL-code"
"PAL-code",
"persist ",
};
if (desc->type < ARRAY_SIZE (types_str))
grub_printf ("%s ", types_str[desc->type]);
@ -87,21 +88,29 @@ grub_cmd_lsefimmap (grub_command_t cmd __attribute__ ((unused)),
desc->physical_start + (desc->num_pages << 12) - 1,
desc->num_pages);
size = desc->num_pages;
size <<= (12 - 10);
if (size < 1024)
grub_printf (" %4" PRIuGRUB_UINT64_T "KB", size);
size = desc->num_pages << 12; /* 4 KiB page size */
/*
* Since size is a multiple of 4 KiB, no need to handle units
* of just Bytes (which would use a mask of 0x3ff).
*
* 14 characters would support the largest possible number of 4 KiB
* pages that are not a multiple of larger units (e.g., MiB):
* 17592186044415 (0xffffff_fffff000), but that uses a lot of
* whitespace for a rare case. 6 characters usually suffices;
* columns will be off if not, but this is preferable to rounding.
*/
if (size & 0xfffff)
grub_printf (" %6" PRIuGRUB_UINT64_T "KiB", size >> 10);
else if (size & 0x3fffffff)
grub_printf (" %6" PRIuGRUB_UINT64_T "MiB", size >> 20);
else if (size & 0xffffffffff)
grub_printf (" %6" PRIuGRUB_UINT64_T "GiB", size >> 30);
else if (size & 0x3ffffffffffff)
grub_printf (" %6" PRIuGRUB_UINT64_T "TiB", size >> 40);
else if (size & 0xfffffffffffffff)
grub_printf (" %6" PRIuGRUB_UINT64_T "PiB", size >> 50);
else
{
size /= 1024;
if (size < 1024)
grub_printf (" %4" PRIuGRUB_UINT64_T "MB", size);
else
{
size /= 1024;
grub_printf (" %4" PRIuGRUB_UINT64_T "GB", size);
}
}
grub_printf (" %6" PRIuGRUB_UINT64_T "EiB", size >> 60);
attr = desc->attribute;
if (attr & GRUB_EFI_MEMORY_RUNTIME)
@ -122,6 +131,12 @@ grub_cmd_lsefimmap (grub_command_t cmd __attribute__ ((unused)),
grub_printf (" RP");
if (attr & GRUB_EFI_MEMORY_XP)
grub_printf (" XP");
if (attr & GRUB_EFI_MEMORY_NV)
grub_printf (" NV");
if (attr & GRUB_EFI_MEMORY_MORE_RELIABLE)
grub_printf (" MR");
if (attr & GRUB_EFI_MEMORY_RO)
grub_printf (" RO");
grub_printf ("\n");
}

View File

@ -37,10 +37,20 @@ static const struct guid_mapping guid_mappings[] =
{
{ GRUB_EFI_ACPI_20_TABLE_GUID, "ACPI-2.0"},
{ GRUB_EFI_ACPI_TABLE_GUID, "ACPI-1.0"},
{ GRUB_EFI_CRC32_GUIDED_SECTION_EXTRACTION_GUID,
"CRC32 GUIDED SECTION EXTRACTION"},
{ GRUB_EFI_DEBUG_IMAGE_INFO_TABLE_GUID, "DEBUG IMAGE INFO"},
{ GRUB_EFI_DXE_SERVICES_TABLE_GUID, "DXE SERVICES"},
{ GRUB_EFI_HCDP_TABLE_GUID, "HCDP"},
{ GRUB_EFI_HOB_LIST_GUID, "HOB LIST"},
{ GRUB_EFI_LZMA_CUSTOM_DECOMPRESS_GUID, "LZMA CUSTOM DECOMPRESS"},
{ GRUB_EFI_MEMORY_TYPE_INFORMATION_GUID, "MEMORY TYPE INFO"},
{ GRUB_EFI_MPS_TABLE_GUID, "MPS"},
{ GRUB_EFI_SAL_TABLE_GUID, "SAL"},
{ GRUB_EFI_SMBIOS_TABLE_GUID, "SMBIOS"},
{ GRUB_EFI_MPS_TABLE_GUID, "MPS"},
{ GRUB_EFI_HCDP_TABLE_GUID, "HCDP"}
{ GRUB_EFI_SYSTEM_RESOURCE_TABLE_GUID, "SYSTEM RESOURCE TABLE"},
{ GRUB_EFI_TIANO_CUSTOM_DECOMPRESS_GUID, "TIANO CUSTOM DECOMPRESS"},
{ GRUB_EFI_TSC_FREQUENCY_GUID, "TSC FREQUENCY"},
};
static grub_err_t
@ -52,6 +62,7 @@ grub_cmd_lsefisystab (struct grub_command *cmd __attribute__ ((unused)),
grub_efi_configuration_table_t *t;
unsigned int i;
grub_printf ("Address: %p\n", st);
grub_printf ("Signature: %016" PRIxGRUB_UINT64_T " revision: %08x\n",
st->hdr.signature, st->hdr.revision);
{

View File

@ -476,8 +476,8 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
be at least 12 bytes and aligned on a 4-byte boundary. */
for (header = buffer;
((char *) header <=
(char *) buffer + len - (type == IS_MULTIBOOT2 ? 16 : 12))
|| (header = 0); header += step)
(char *) buffer + len - (type == IS_MULTIBOOT2 ? 16 : 12));
header += step)
{
if (header[0] == magic
&& !(grub_le_to_cpu32 (header[0])
@ -485,11 +485,12 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
+ grub_le_to_cpu32 (header[2])
+ (type == IS_MULTIBOOT2
? grub_le_to_cpu32 (header[3]) : 0)))
break;
{
ret = 1;
break;
}
}
if (header != 0)
ret = 1;
grub_free (buffer);
break;
}

View File

@ -18,6 +18,7 @@
#include <grub/fileid.h>
#include <grub/elfload.h>
#include <grub/misc.h>
#pragma GCC diagnostic ignored "-Wcast-align"
@ -39,10 +40,10 @@ grub_file_check_netbsdXX (grub_elf_t elf)
return 0;
if (grub_file_seek (elf->file, elf->ehdr.ehdrXX.e_shoff) == (grub_off_t) -1)
return 0;
goto fail;
if (grub_file_read (elf->file, s0, shsize) != (grub_ssize_t) shsize)
return 0;
goto fail;
s = (Elf_Shdr *) ((char *) s0 + elf->ehdr.ehdrXX.e_shstrndx * shentsize);
stroff = s->sh_offset;
@ -53,18 +54,21 @@ grub_file_check_netbsdXX (grub_elf_t elf)
char name[sizeof(".note.netbsd.ident")];
grub_memset (name, 0, sizeof (name));
if (grub_file_seek (elf->file, stroff + s->sh_name) == (grub_off_t) -1)
return grub_errno;
goto fail;
if (grub_file_read (elf->file, name, sizeof (name)) != (grub_ssize_t) sizeof (name))
{
if (grub_errno)
return grub_errno;
goto fail;
continue;
}
if (grub_memcmp (name, ".note.netbsd.ident",
sizeof(".note.netbsd.ident")) != 0)
continue;
grub_free (s0);
return 1;
}
fail:
grub_free (s0);
return 0;
}

View File

@ -101,7 +101,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
}
/* Check if it is valid. */
if (mbr.signature != grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE))
if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE))
{
grub_device_close (dev);
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
@ -216,7 +216,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
first_sector--;
mbr.entries[0].flag = 0;
mbr.entries[0].type = GRUB_PC_PARTITION_TYPE_GPT_DISK;
mbr.entries[0].start = grub_cpu_to_le32 (1);
mbr.entries[0].start = grub_cpu_to_le32_compile_time (1);
lba_to_chs (1,
&(mbr.entries[0].start_sector),
&(mbr.entries[0].start_cylinder),
@ -227,7 +227,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
&(mbr.entries[0].end_head));
mbr.entries[0].length = grub_cpu_to_le32 (first_sector);
mbr.signature = grub_cpu_to_le16 (GRUB_PC_PARTITION_SIGNATURE);
mbr.signature = grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE);
if (grub_disk_write (dev->disk, 0, 0, sizeof (mbr), &mbr))
{
@ -235,6 +235,8 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
return grub_errno;
}
grub_device_close (dev);
grub_printf_ (N_("New MBR is written to `%s'\n"), args[0]);
return GRUB_ERR_NONE;

View File

@ -329,6 +329,7 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args)
break;
}
default:
grub_disk_close (disk);
return grub_error (GRUB_ERR_IO, "not an ATA device");
}

View File

@ -45,7 +45,7 @@ static grub_err_t
grub_cmd_cmostest (struct grub_command *cmd __attribute__ ((unused)),
int argc, char *argv[])
{
int byte, bit;
int byte = 0, bit = 0;
grub_err_t err;
grub_uint8_t value;
@ -67,7 +67,7 @@ static grub_err_t
grub_cmd_cmosclean (struct grub_command *cmd __attribute__ ((unused)),
int argc, char *argv[])
{
int byte, bit;
int byte = 0, bit = 0;
grub_err_t err;
grub_uint8_t value;
@ -85,7 +85,7 @@ static grub_err_t
grub_cmd_cmosset (struct grub_command *cmd __attribute__ ((unused)),
int argc, char *argv[])
{
int byte, bit;
int byte = 0, bit = 0;
grub_err_t err;
grub_uint8_t value;

View File

@ -39,9 +39,17 @@ static const char *descs[] = {
[2] = "before RAM init",
[3] = "after RAM init",
[4] = "end of romstage",
[5] = "start of verified boot",
[6] = "end of verified boot",
[8] = "start of RAM copy",
[9] = "end of RAM copy",
[10] = "start of ramstage",
[11] = "start of bootblock",
[12] = "end of bootblock",
[13] = "starting to load romstage",
[14] = "finished loading romstage",
[15] = "starting LZMA decompress (ignore for x86)",
[16] = "finished LZMA decompress (ignore for x86)",
[30] = "device enumerate",
[40] = "device configure",
[50] = "device enable",

View File

@ -107,6 +107,14 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
return grub_errno;
}
if (!tempo)
{
grub_file_close (file);
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid tempo in %s"),
args[0]);
return grub_errno;
}
tempo = grub_le_to_cpu32 (tempo);
grub_dprintf ("play","tempo = %d\n", tempo);
@ -131,6 +139,13 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
tempo = grub_strtoul (args[0], &end, 0);
if (!tempo)
{
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid tempo in %s"),
args[0]);
return grub_errno;
}
if (*end)
/* Was not a number either, assume it was supposed to be a file name. */
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), args[0]);

View File

@ -292,7 +292,7 @@ find_key_code (char *key)
{
unsigned i;
for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++)
for (i = 0; i < ARRAY_SIZE(keysym_table); i++)
{
if (keysym_table[i].unshifted_name
&& grub_strcmp (key, keysym_table[i].unshifted_name) == 0)
@ -311,7 +311,7 @@ find_ascii_code (char *key)
{
unsigned i;
for (i = 0; i < sizeof (keysym_table) / sizeof (keysym_table[0]); i++)
for (i = 0; i < ARRAY_SIZE(keysym_table); i++)
{
if (keysym_table[i].unshifted_name
&& grub_strcmp (key, keysym_table[i].unshifted_name) == 0)
@ -352,15 +352,13 @@ grub_cmd_sendkey (grub_extcmd_context_t ctxt, int argc, char **args)
{
unsigned i;
for (i = 0; i < sizeof (simple_flag_offsets)
/ sizeof (simple_flag_offsets[0]); i++)
for (i = 0; i < ARRAY_SIZE(simple_flag_offsets); 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);
noled = (state[ARRAY_SIZE(simple_flag_offsets)].set);
return GRUB_ERR_NONE;
}

View File

@ -173,8 +173,10 @@ grub_term_map_key (grub_keyboard_key_t code, int status)
key = map_key_core (code, status, &alt_gr_consumed);
if (key == 0 || key == GRUB_TERM_SHIFT)
if (key == 0 || key == GRUB_TERM_SHIFT) {
grub_printf ("Unknown key 0x%x detected\n", code);
return GRUB_TERM_NO_KEY;
}
if (status & GRUB_TERM_STATUS_CAPS)
{

View File

@ -57,14 +57,20 @@ legacy_file (const char *filename)
file = grub_file_open (filename);
if (! file)
return grub_errno;
{
grub_free (suffix);
return grub_errno;
}
menu = grub_env_get_menu ();
if (! menu)
{
menu = grub_zalloc (sizeof (*menu));
if (! menu)
return grub_errno;
{
grub_free (suffix);
return grub_errno;
}
grub_env_set_menu (menu);
}
@ -77,6 +83,7 @@ legacy_file (const char *filename)
if (!buf && grub_errno)
{
grub_file_close (file);
grub_free (suffix);
return grub_errno;
}
@ -173,6 +180,8 @@ legacy_file (const char *filename)
if (!args)
{
grub_file_close (file);
grub_free (suffix);
grub_free (entrysrc);
return grub_errno;
}
args[0] = entryname;
@ -244,6 +253,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
struct grub_command *cmd;
char **cutargs;
int cutargc;
grub_err_t err = GRUB_ERR_NONE;
for (i = 0; i < 2; i++)
{
@ -305,6 +315,8 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
cutargs = grub_malloc (sizeof (cutargs[0]) * (argc - 1));
if (!cutargs)
return grub_errno;
cutargc = argc - 1;
grub_memcpy (cutargs + 1, args + 2, sizeof (cutargs[0]) * (argc - 2));
cutargs[0] = args[0];
@ -324,7 +336,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
if (!(cmd->func) (cmd, cutargc, cutargs))
{
kernel_type = LINUX;
return GRUB_ERR_NONE;
goto out;
}
}
grub_errno = GRUB_ERR_NONE;
@ -339,7 +351,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
if (!(cmd->func) (cmd, argc, args))
{
kernel_type = MULTIBOOT;
return GRUB_ERR_NONE;
goto out;
}
}
grub_errno = GRUB_ERR_NONE;
@ -376,6 +388,8 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
if (part && grub_strcmp (part->partmap->name, "msdos") == 0)
bsd_slice = part->number;
}
if (dev)
grub_device_close (dev);
}
/* k*BSD didn't really work well with grub-legacy. */
@ -402,7 +416,7 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
if (!(cmd->func) (cmd, cutargc, cutargs))
{
kernel_type = KFREEBSD;
return GRUB_ERR_NONE;
goto out;
}
}
grub_errno = GRUB_ERR_NONE;
@ -411,6 +425,8 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
char **bsdargs;
int bsdargc;
char bsddevname[sizeof ("wdXXXXXXXXXXXXY")];
int found = 0;
if (bsd_device == -1)
{
bsdargs = cutargs;
@ -421,6 +437,11 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
char rbuf[3] = "-r";
bsdargc = cutargc + 2;
bsdargs = grub_malloc (sizeof (bsdargs[0]) * bsdargc);
if (!bsdargs)
{
err = grub_errno;
goto out;
}
grub_memcpy (bsdargs, args, argc * sizeof (bsdargs[0]));
bsdargs[argc] = rbuf;
bsdargs[argc + 1] = bsddevname;
@ -436,7 +457,8 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
if (!(cmd->func) (cmd, bsdargc, bsdargs))
{
kernel_type = KNETBSD;
return GRUB_ERR_NONE;
found = 1;
goto free_bsdargs;
}
}
grub_errno = GRUB_ERR_NONE;
@ -449,20 +471,28 @@ grub_cmd_legacy_kernel (struct grub_command *mycmd __attribute__ ((unused)),
if (!(cmd->func) (cmd, bsdargc, bsdargs))
{
kernel_type = KOPENBSD;
return GRUB_ERR_NONE;
found = 1;
goto free_bsdargs;
}
}
grub_errno = GRUB_ERR_NONE;
}
free_bsdargs:
if (bsdargs != cutargs)
grub_free (bsdargs);
if (found)
goto out;
}
}
}
while (0);
return grub_error (GRUB_ERR_BAD_OS, "couldn't load file %s",
args[0]);
err = grub_error (GRUB_ERR_BAD_OS, "couldn't load file %s",
args[0]);
out:
grub_free (cutargs);
return err;
}
static grub_err_t
@ -523,15 +553,17 @@ grub_cmd_legacy_initrdnounzip (struct grub_command *mycmd __attribute__ ((unused
char **newargs;
grub_err_t err;
char nounzipbuf[10] = "--nounzip";
cmd = grub_command_find ("module");
if (!cmd)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("can't find command `%s'"),
"module");
newargs = grub_malloc ((argc + 1) * sizeof (newargs[0]));
if (!newargs)
return grub_errno;
grub_memcpy (newargs + 1, args, argc * sizeof (newargs[0]));
newargs[0] = nounzipbuf;
cmd = grub_command_find ("module");
if (!cmd)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("can't find command `%s'"),
"module");
err = cmd->func (cmd, argc + 1, newargs);
grub_free (newargs);
@ -580,7 +612,7 @@ check_password_md5_real (const char *entered,
GRUB_MD_MD5->write (ctx, entered, enteredlen);
digest = GRUB_MD_MD5->read (ctx);
GRUB_MD_MD5->final (ctx);
memcpy (alt_result, digest, MD5_HASHLEN);
grub_memcpy (alt_result, digest, MD5_HASHLEN);
GRUB_MD_MD5->init (ctx);
GRUB_MD_MD5->write (ctx, entered, enteredlen);
@ -596,7 +628,7 @@ check_password_md5_real (const char *entered,
for (i = 0; i < 1000; i++)
{
memcpy (alt_result, digest, 16);
grub_memcpy (alt_result, digest, 16);
GRUB_MD_MD5->init (ctx);
if ((i & 1) != 0)

View File

@ -263,7 +263,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
for (q = p->next; q; q = q->next)
{
grub_disk_addr_t s1, s2;
grub_disk_addr_t e1, e2, t;
grub_disk_addr_t e1, e2;
s1 = p->sector;
e1 = s1 + ((p->length + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS);
@ -271,16 +271,7 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
s2 = q->sector;
e2 = s2 + ((q->length + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS);
if (s2 > s1)
{
t = s2;
s2 = s1;
s1 = t;
t = e2;
e2 = e1;
e1 = t;
}
if (e1 > s2)
if (s1 < e2 && s2 < e1)
{
/* This might be actually valid, but it is unbelievable that
any filesystem makes such a silly allocation. */

View File

@ -37,6 +37,8 @@ static const char *names[] =
is required to save accross hibernations. */
[GRUB_MEMORY_NVS] = N_("ACPI non-volatile storage RAM"),
[GRUB_MEMORY_BADRAM] = N_("faulty RAM (BadRAM)"),
[GRUB_MEMORY_PERSISTENT] = N_("persistent RAM"),
[GRUB_MEMORY_PERSISTENT_LEGACY] = N_("persistent RAM (legacy)"),
[GRUB_MEMORY_COREBOOT_TABLES] = N_("RAM holding coreboot tables"),
[GRUB_MEMORY_CODE] = N_("RAM holding firmware code")
};

View File

@ -37,7 +37,7 @@ struct find_node_context
grub_uint64_t inode_found;
char *dirname;
enum
{ NONE, FILE, DIR } found;
{ FOUND_NONE, FOUND_FILE, FOUND_DIR } found;
};
static int
@ -53,7 +53,7 @@ find_inode (const char *filename,
&& grub_strcasecmp (ctx->dirname, filename) == 0)))
{
ctx->inode_found = info->inode;
ctx->found = info->dir ? DIR : FILE;
ctx->found = info->dir ? FOUND_DIR : FOUND_FILE;
}
return 0;
}
@ -106,7 +106,7 @@ grub_mac_bless_inode (grub_device_t dev, grub_uint32_t inode, int is_dir,
ablk_size = grub_be_to_cpu32 (volheader.hfs.blksz);
ablk_start = grub_be_to_cpu16 (volheader.hfs.first_block);
embedded_offset = (ablk_start
+ extent_start
+ ((grub_uint64_t) extent_start)
* (ablk_size >> GRUB_DISK_SECTOR_BITS));
err =
@ -175,7 +175,7 @@ grub_mac_bless_file (grub_device_t dev, const char *path_in, int intel)
grub_free (path);
return grub_mac_bless_inode (dev, (grub_uint32_t) ctx.inode_found,
(ctx.found == DIR), intel);
(ctx.found == FOUND_DIR), intel);
}
static grub_err_t
@ -183,7 +183,7 @@ grub_cmd_macbless (grub_command_t cmd, int argc, char **args)
{
char *device_name;
char *path = 0;
grub_device_t dev;
grub_device_t dev = 0;
grub_err_t err;
if (argc != 1)
@ -197,13 +197,12 @@ grub_cmd_macbless (grub_command_t cmd, int argc, char **args)
else
path = path + 1;
if (!path || *path == 0 || !device_name)
if (!path || *path == 0 || !dev)
{
if (dev)
grub_device_close (dev);
grub_free (device_name);
grub_free (path);
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument");
}

View File

@ -57,6 +57,7 @@ get_uuid (const char *name, char **uuid, int getnative)
if (!dev->disk)
{
grub_dprintf ("nativedisk", "Skipping non-disk\n");
grub_device_close (dev);
return 0;
}
@ -90,6 +91,7 @@ get_uuid (const char *name, char **uuid, int getnative)
case GRUB_DISK_DEVICE_MEMDISK_ID:
grub_dprintf ("nativedisk", "Skipping native disk %s\n",
dev->disk->name);
grub_device_close (dev);
return 0;
/* FIXME: those probably need special handling. */
@ -196,7 +198,10 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)),
return grub_errno;
if (get_uuid (NULL, &uuid_root, 0))
return grub_errno;
{
grub_free (mods);
return grub_errno;
}
prefdev = grub_file_get_device_name (prefix);
if (grub_errno)
@ -208,6 +213,8 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)),
if (get_uuid (prefdev, &uuid_prefix, 0))
{
grub_free (uuid_root);
grub_free (prefdev);
grub_free (mods);
return grub_errno;
}
@ -287,12 +294,15 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)),
}
grub_free (uuid_root);
grub_free (uuid_prefix);
grub_free (prefdev);
grub_free (mods);
return GRUB_ERR_NONE;
fail:
grub_free (uuid_root);
grub_free (uuid_prefix);
grub_free (prefdev);
for (i = 0; i < mods_loaded; i++)
if (mods[i])
@ -300,6 +310,8 @@ grub_cmd_nativedisk (grub_command_t cmd __attribute__ ((unused)),
mods[i]->fini = 0;
grub_dl_unload (mods[i]);
}
grub_free (mods);
return grub_errno;
}

View File

@ -243,11 +243,19 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
}
if (argc == 1)
return show_help (dev);
{
err = show_help (dev);
grub_device_close (dev);
return err;
}
for (i = 1; i < argc; i++)
if (grub_strcmp (args[i], "help") == 0)
return show_help (dev);
{
err = show_help (dev);
grub_device_close (dev);
return err;
}
parsed = (int *) grub_zalloc (argc * sizeof (int));
@ -274,8 +282,12 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
break;
}
if (! cur)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unknown argument `%s'"),
{
grub_free (parsed);
grub_device_close (dev);
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unknown argument `%s'"),
args[i]);
}
ptool = cur;
pargs = (struct grub_parttool_args *)
grub_zalloc (ptool->nargs * sizeof (struct grub_parttool_args));

View File

@ -45,6 +45,7 @@ check_password (const char *user, const char *entered, void *pin)
grub_uint8_t *buf;
struct pbkdf2_password *pass = pin;
gcry_err_code_t err;
grub_err_t ret;
buf = grub_malloc (pass->buflen);
if (!buf)
@ -55,17 +56,17 @@ check_password (const char *user, const char *entered, void *pin)
pass->salt, pass->saltlen, pass->c,
buf, pass->buflen);
if (err)
ret = grub_crypto_gcry_error (err);
else if (grub_crypto_memcmp (buf, pass->expected, pass->buflen) != 0)
ret = GRUB_ACCESS_DENIED;
else
{
grub_free (buf);
return grub_crypto_gcry_error (err);
grub_auth_authenticate (user);
ret = GRUB_ERR_NONE;
}
if (grub_crypto_memcmp (buf, pass->expected, pass->buflen) != 0)
return GRUB_ACCESS_DENIED;
grub_auth_authenticate (user);
return GRUB_ERR_NONE;
grub_free (buf);
return ret;
}
static inline int
@ -104,7 +105,10 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
pass->c = grub_strtoul (ptr, &ptr, 0);
if (grub_errno)
return grub_errno;
{
grub_free (pass);
return grub_errno;
}
if (*ptr != '.')
{
grub_free (pass);

View File

@ -64,7 +64,7 @@ iterate_device (const char *name, void *data)
/* Skip floppy drives when requested. */
if (ctx->no_floppy &&
name[0] == 'f' && name[1] == 'd' && name[2] >= '0' && name[2] <= '9')
return 0;
return 1;
#ifdef DO_SEARCH_FS_UUID
#define compare_fn grub_strcasecmp
@ -210,10 +210,10 @@ try (struct search_ctx *ctx)
/* Cache entry was outdated. Remove it. */
if (!ctx->count)
{
*prev = cache_ent->next;
grub_free (cache_ent->key);
grub_free (cache_ent->value);
grub_free (cache_ent);
*prev = cache_ent->next;
}
}

View File

@ -175,7 +175,10 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args)
var = "root";
}
else
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
{
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected"));
goto out;
}
if (state[SEARCH_LABEL].set)
grub_search_label (id, var, state[SEARCH_NO_FLOPPY].set,
@ -187,8 +190,10 @@ grub_cmd_search (grub_extcmd_context_t ctxt, int argc, char **args)
grub_search_fs_file (id, var, state[SEARCH_NO_FLOPPY].set,
hints, nhints);
else
return grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type");
grub_error (GRUB_ERR_INVALID_COMMAND, "unspecified search type");
out:
grub_free (hints);
return grub_errno;
}

View File

@ -50,7 +50,7 @@ static const struct grub_arg_option options[] =
N_("root directory of the syslinux disk [default=/]."),
N_("DIR"), ARG_TYPE_STRING},
{"cwd", 'c', 0,
N_("current directory of the syslinux [default is parent directory of input file]."),
N_("current directory of syslinux [default is parent directory of input file]."),
N_("DIR"), ARG_TYPE_STRING},
{"isolinux", 'i', 0, N_("assume input is an isolinux configuration file."), 0, 0},
{"pxelinux", 'p', 0, N_("assume input is a pxelinux configuration file."), 0, 0},
@ -119,7 +119,10 @@ syslinux_file (grub_extcmd_context_t ctxt, const char *filename)
{
menu = grub_zalloc (sizeof (*menu));
if (! menu)
return grub_errno;
{
grub_free (result);
return grub_errno;
}
grub_env_set_menu (menu);
}

View File

@ -332,7 +332,7 @@ test_parse (char **args, int *argn, int argc)
get_fileinfo (args[*argn + 1], &ctx);
update_val (ctx.file_exists && ctx.file_info.dir, &ctx);
(*argn) += 2;
return ctx.or || ctx.and;
continue;
}
if (grub_strcmp (args[*argn], "-e") == 0)
@ -340,7 +340,7 @@ test_parse (char **args, int *argn, int argc)
get_fileinfo (args[*argn + 1], &ctx);
update_val (ctx.file_exists, &ctx);
(*argn) += 2;
return ctx.or || ctx.and;
continue;
}
if (grub_strcmp (args[*argn], "-f") == 0)
@ -349,7 +349,7 @@ test_parse (char **args, int *argn, int argc)
/* FIXME: check for other types. */
update_val (ctx.file_exists && ! ctx.file_info.dir, &ctx);
(*argn) += 2;
return ctx.or || ctx.and;
continue;
}
if (grub_strcmp (args[*argn], "-s") == 0)
@ -362,7 +362,7 @@ test_parse (char **args, int *argn, int argc)
grub_file_close (file);
grub_errno = GRUB_ERR_NONE;
(*argn) += 2;
return ctx.or || ctx.and;
continue;
}
/* String tests. */

View File

@ -80,7 +80,7 @@ grub_cmd_tr (grub_extcmd_context_t ctxt, int argc, char **args)
} else if (argc > 3)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "too many parameters");
if (argc <= 0 && (!s1 || !s2 || !input))
if (!s1 || !s2 || !input)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "missing parameters");
if (grub_strlen (s1) != grub_strlen (s2))

View File

@ -33,6 +33,13 @@
GRUB_MOD_LICENSE ("GPLv3+");
struct grub_verified
{
grub_file_t file;
void *buf;
};
typedef struct grub_verified *grub_verified_t;
enum
{
OPTION_SKIP_SIG = 0
@ -301,7 +308,7 @@ grub_load_public_key (grub_file_t f)
if (!sk)
goto fail;
grub_memset (fingerprint_context, 0, sizeof (fingerprint_context));
grub_memset (fingerprint_context, 0, GRUB_MD_SHA1->contextsize);
GRUB_MD_SHA1->init (fingerprint_context);
GRUB_MD_SHA1->write (fingerprint_context, "\x99", 1);
len_be = grub_cpu_to_be16 (len);
@ -317,19 +324,19 @@ grub_load_public_key (grub_file_t f)
if (grub_file_read (f, &l, sizeof (l)) != sizeof (l))
{
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
goto fail;
break;
}
lb = (grub_be_to_cpu16 (l) + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT;
if (lb > READBUF_SIZE - sizeof (grub_uint16_t))
{
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
goto fail;
break;
}
if (grub_file_read (f, buffer + sizeof (grub_uint16_t), lb) != (grub_ssize_t) lb)
{
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
goto fail;
break;
}
grub_memcpy (buffer, &l, sizeof (l));
@ -339,10 +346,16 @@ grub_load_public_key (grub_file_t f)
buffer, lb + sizeof (grub_uint16_t), 0))
{
grub_error (GRUB_ERR_BAD_SIGNATURE, N_("bad signature"));
goto fail;
break;
}
}
if (i < pkalgos[pk].nmpipub)
{
grub_free (sk);
goto fail;
}
GRUB_MD_SHA1->final (fingerprint_context);
grub_memcpy (sk->fingerprint, GRUB_MD_SHA1->read (fingerprint_context), 20);
@ -447,7 +460,7 @@ grub_verify_signature_real (char *buf, grub_size_t size,
grub_err_t err;
grub_size_t i;
gcry_mpi_t mpis[10];
grub_uint8_t type;
grub_uint8_t type = 0;
err = read_packet_header (sig, &type, &len);
if (err)
@ -802,19 +815,39 @@ grub_cmd_verify_signature (grub_extcmd_context_t ctxt,
static int sec = 0;
static void
verified_free (grub_verified_t verified)
{
if (verified)
{
grub_free (verified->buf);
grub_free (verified);
}
}
static grub_ssize_t
verified_read (struct grub_file *file, char *buf, grub_size_t len)
{
grub_memcpy (buf, (char *) file->data + file->offset, len);
grub_verified_t verified = file->data;
grub_memcpy (buf, (char *) verified->buf + file->offset, len);
return len;
}
static grub_err_t
verified_close (struct grub_file *file)
{
grub_free (file->data);
grub_verified_t verified = file->data;
grub_file_close (verified->file);
verified_free (verified);
file->data = 0;
return GRUB_ERR_NONE;
/* device and name are freed by parent */
file->device = 0;
file->name = 0;
return grub_errno;
}
struct grub_fs verified_fs =
@ -832,10 +865,13 @@ grub_pubkey_open (grub_file_t io, const char *filename)
grub_err_t err;
grub_file_filter_t curfilt[GRUB_FILE_FILTER_MAX];
grub_file_t ret;
grub_verified_t verified;
if (!sec)
return io;
if (io->device->disk && io->device->disk->id == GRUB_DISK_DEVICE_MEMDISK_ID)
if (io->device->disk &&
(io->device->disk->dev->id == GRUB_DISK_DEVICE_MEMDISK_ID
|| io->device->disk->dev->id == GRUB_DISK_DEVICE_PROCFS_ID))
return io;
fsuf = grub_malloc (grub_strlen (filename) + sizeof (".sig"));
if (!fsuf)
@ -855,7 +891,10 @@ grub_pubkey_open (grub_file_t io, const char *filename)
ret = grub_malloc (sizeof (*ret));
if (!ret)
return NULL;
{
grub_file_close (sig);
return NULL;
}
*ret = *io;
ret->fs = &verified_fs;
@ -864,29 +903,46 @@ grub_pubkey_open (grub_file_t io, const char *filename)
{
grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
"big file signature isn't implemented yet");
return NULL;
}
ret->data = grub_malloc (ret->size);
if (!ret->data)
{
grub_file_close (sig);
grub_free (ret);
return NULL;
}
if (grub_file_read (io, ret->data, ret->size) != (grub_ssize_t) ret->size)
verified = grub_malloc (sizeof (*verified));
if (!verified)
{
grub_file_close (sig);
grub_free (ret);
return NULL;
}
verified->buf = grub_malloc (ret->size);
if (!verified->buf)
{
grub_file_close (sig);
grub_free (verified);
grub_free (ret);
return NULL;
}
if (grub_file_read (io, verified->buf, ret->size) != (grub_ssize_t) ret->size)
{
if (!grub_errno)
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
filename);
grub_file_close (sig);
verified_free (verified);
grub_free (ret);
return NULL;
}
err = grub_verify_signature_real (ret->data, ret->size, 0, sig, NULL);
err = grub_verify_signature_real (verified->buf, ret->size, 0, sig, NULL);
grub_file_close (sig);
if (err)
return NULL;
io->device = 0;
io->name = 0;
grub_file_close (io);
{
verified_free (verified);
grub_free (ret);
return NULL;
}
verified->file = io;
ret->data = verified;
return ret;
}

View File

@ -245,7 +245,10 @@ match_devices_iter (const char *name, void *data)
t = grub_realloc (ctx->devs, sizeof (char*) * (ctx->ndev + 2));
if (! t)
return 1;
{
grub_free (buffer);
return 1;
}
ctx->devs = t;
ctx->devs[ctx->ndev++] = buffer;
@ -290,7 +293,8 @@ struct match_files_ctx
/* Helper for match_files. */
static int
match_files_iter (const char *name, const struct grub_dirhook_info *info,
match_files_iter (const char *name,
const struct grub_dirhook_info *info __attribute__((unused)),
void *data)
{
struct match_files_ctx *ctx = data;

View File

@ -72,13 +72,13 @@ AF_merge (const gcry_md_spec_t * hash, grub_uint8_t * src, grub_uint8_t * dst,
grub_size_t i;
grub_uint8_t *bufblock;
if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN || hash->mdlen == 0)
return GPG_ERR_INV_ARG;
bufblock = grub_zalloc (blocksize);
if (bufblock == NULL)
return GPG_ERR_OUT_OF_MEMORY;
if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN)
return GPG_ERR_INV_ARG;
grub_memset (bufblock, 0, blocksize);
for (i = 0; i < blocknumbers - 1; i++)
{

View File

@ -32,7 +32,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
struct grub_ahci_cmd_head
{
grub_uint32_t config;
grub_uint32_t transfered;
grub_uint32_t transferred;
grub_uint64_t command_table_base;
grub_uint32_t unused[4];
};
@ -194,13 +194,11 @@ grub_ahci_pciinit (grub_pci_device_t dev,
return 0;
addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
grub_pci_write_word (addr, grub_pci_read_word (addr) |
GRUB_PCI_COMMAND_IO_ENABLED
| GRUB_PCI_COMMAND_MEM_ENABLED
| GRUB_PCI_COMMAND_BUS_MASTER);
grub_pci_write_word (addr, grub_pci_read_word (addr)
| GRUB_PCI_COMMAND_MEM_ENABLED | GRUB_PCI_COMMAND_BUS_MASTER);
hba = grub_pci_device_map_range (dev, bar & GRUB_PCI_ADDR_MEM_MASK,
sizeof (hba));
sizeof (*hba));
grub_dprintf ("ahci", "dev: %x:%x.%x\n", dev.bus, dev.device, dev.function);
grub_dprintf ("ahci", "tfd[0]: %x\n",
@ -324,7 +322,7 @@ grub_ahci_pciinit (grub_pci_device_t dev,
grub_dprintf ("ahci", "GLC:%x\n", hba->global_control);
nports = (hba->cap & GRUB_AHCI_HBA_CAP_NPORTS_MASK) + 1;
nports = (GRUB_AHCI_HBA_CAP_NPORTS_MASK) + 1;
grub_dprintf ("ahci", "%d AHCI ports, PI = 0x%x\n", nports,
hba->ports_implemented);
@ -357,10 +355,10 @@ grub_ahci_pciinit (grub_pci_device_t dev,
if (adevs[i])
{
adevs[i]->hba->ports[adevs[i]->port].sata_error = adevs[i]->hba->ports[adevs[i]->port].sata_error;
grub_dprintf ("ahci", "err: %x\n",
grub_dprintf ("ahci", "port: %d, err: %x\n", adevs[i]->port,
adevs[i]->hba->ports[adevs[i]->port].sata_error);
adevs[i]->command_list_chunk = grub_memalign_dma32 (1024, sizeof (struct grub_ahci_cmd_head));
adevs[i]->command_list_chunk = grub_memalign_dma32 (1024, sizeof (struct grub_ahci_cmd_head) * 32);
if (!adevs[i]->command_list_chunk)
{
adevs[i] = 0;
@ -378,6 +376,12 @@ grub_ahci_pciinit (grub_pci_device_t dev,
adevs[i]->command_list = grub_dma_get_virt (adevs[i]->command_list_chunk);
adevs[i]->command_table = grub_dma_get_virt (adevs[i]->command_table_chunk);
grub_memset ((void *) adevs[i]->command_list, 0,
sizeof (struct grub_ahci_cmd_table));
grub_memset ((void *) adevs[i]->command_table, 0,
sizeof (struct grub_ahci_cmd_head) * 32);
adevs[i]->command_list->command_table_base
= grub_dma_get_phys (adevs[i]->command_table_chunk);
@ -436,7 +440,7 @@ grub_ahci_pciinit (grub_pci_device_t dev,
adevs[i]->hba->ports[adevs[i]->port].intstatus = ~0;
// adevs[i]->hba->ports[adevs[i]->port].fbs = 0;
grub_dprintf ("ahci", "err: %x\n",
grub_dprintf ("ahci", "port: %d, err: %x\n", adevs[i]->port,
adevs[i]->hba->ports[adevs[i]->port].sata_error);
adevs[i]->rfis = grub_memalign_dma32 (4096,
@ -450,6 +454,7 @@ grub_ahci_pciinit (grub_pci_device_t dev,
adevs[i]->hba->ports[adevs[i]->port].fis_base = grub_dma_get_phys (adevs[i]->rfis);
adevs[i]->hba->ports[adevs[i]->port].command_list_base
= grub_dma_get_phys (adevs[i]->command_list_chunk);
adevs[i]->hba->ports[adevs[i]->port].command_issue = 0;
adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_FRE;
}
@ -475,7 +480,7 @@ grub_ahci_pciinit (grub_pci_device_t dev,
for (i = 0; i < nports; i++)
if (adevs[i])
{
grub_dprintf ("ahci", "err: %x\n",
grub_dprintf ("ahci", "port: %d, err: %x\n", adevs[i]->port,
adevs[i]->hba->ports[adevs[i]->port].sata_error);
fr_running |= (1 << i);
@ -483,7 +488,7 @@ grub_ahci_pciinit (grub_pci_device_t dev,
adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_POWER_ON;
adevs[i]->hba->ports[adevs[i]->port].command |= 1 << 28;
grub_dprintf ("ahci", "err: %x\n",
grub_dprintf ("ahci", "port: %d, err: %x\n", adevs[i]->port,
adevs[i]->hba->ports[adevs[i]->port].sata_error);
}
@ -510,26 +515,26 @@ grub_ahci_pciinit (grub_pci_device_t dev,
for (i = 0; i < nports; i++)
if (adevs[i])
{
grub_dprintf ("ahci", "err: %x\n",
grub_dprintf ("ahci", "port %d, err: %x\n", adevs[i]->port,
adevs[i]->hba->ports[adevs[i]->port].sata_error);
adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_POWER_ON;
adevs[i]->hba->ports[adevs[i]->port].command |= GRUB_AHCI_HBA_PORT_CMD_SPIN_UP;
grub_dprintf ("ahci", "err: %x\n",
grub_dprintf ("ahci", "port %d, err: %x\n", adevs[i]->port,
adevs[i]->hba->ports[adevs[i]->port].sata_error);
adevs[i]->hba->ports[adevs[i]->port].sata_error = ~0;
grub_dprintf ("ahci", "err: %x\n",
grub_dprintf ("ahci", "port %d, err: %x\n", adevs[i]->port,
adevs[i]->hba->ports[adevs[i]->port].sata_error);
grub_dprintf ("ahci", "offset: %x, tfd:%x, CMD: %x\n",
grub_dprintf ("ahci", "port %d, offset: %x, tfd:%x, CMD: %x\n", adevs[i]->port,
(int) ((char *) &adevs[i]->hba->ports[adevs[i]->port].task_file_data -
(char *) adevs[i]->hba),
adevs[i]->hba->ports[adevs[i]->port].task_file_data,
adevs[i]->hba->ports[adevs[i]->port].command);
grub_dprintf ("ahci", "err: %x\n",
grub_dprintf ("ahci", "port %d, err: %x\n", adevs[i]->port,
adevs[i]->hba->ports[adevs[i]->port].sata_error);
}
@ -537,17 +542,19 @@ grub_ahci_pciinit (grub_pci_device_t dev,
for (i = 0; i < nports; i++)
if (adevs[i])
{
grub_dprintf ("ahci", "offset: %x, tfd:%x, CMD: %x\n",
grub_dprintf ("ahci", "port %d, offset: %x, tfd:%x, CMD: %x\n", adevs[i]->port,
(int) ((char *) &adevs[i]->hba->ports[adevs[i]->port].task_file_data -
(char *) adevs[i]->hba),
adevs[i]->hba->ports[adevs[i]->port].task_file_data,
adevs[i]->hba->ports[adevs[i]->port].command);
grub_dprintf ("ahci", "err: %x\n",
grub_dprintf ("ahci", "port: %d, err: %x\n", adevs[i]->port,
adevs[i]->hba->ports[adevs[i]->port].sata_error);
adevs[i]->hba->ports[adevs[i]->port].command
= (adevs[i]->hba->ports[adevs[i]->port].command & 0x0fffffff) | (1 << 28) | 2 | 4;
= (adevs[i]->hba->ports[adevs[i]->port].command & 0x0fffffff) | (1 << 28)
| GRUB_AHCI_HBA_PORT_CMD_SPIN_UP
| GRUB_AHCI_HBA_PORT_CMD_POWER_ON;
/* struct grub_disk_ata_pass_through_parms parms2;
grub_memset (&parms2, 0, sizeof (parms2));
@ -560,14 +567,14 @@ grub_ahci_pciinit (grub_pci_device_t dev,
while (grub_get_time_ms () < endtime)
{
for (i = 0; i < nports; i++)
if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].task_file_data & 0x88))
if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].task_file_data & (GRUB_ATA_STATUS_BUSY | GRUB_ATA_STATUS_DRQ)))
break;
if (i == nports)
break;
}
for (i = 0; i < nports; i++)
if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].task_file_data & 0x88))
if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].task_file_data & (GRUB_ATA_STATUS_BUSY | GRUB_ATA_STATUS_DRQ)))
{
grub_dprintf ("ahci", "port %d is busy\n", i);
failed_adevs[i] = adevs[i];
@ -596,6 +603,9 @@ grub_ahci_pciinit (grub_pci_device_t dev,
failed_adevs[i] = adevs[i];
adevs[i] = 0;
}
grub_dprintf ("ahci", "cleaning up failed devs\n");
for (i = 0; i < nports; i++)
if (failed_adevs[i] && (fr_running & (1 << i)))
failed_adevs[i]->hba->ports[failed_adevs[i]->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_FRE;
@ -621,6 +631,10 @@ grub_ahci_pciinit (grub_pci_device_t dev,
if (adevs[i] && (adevs[i]->hba->ports[adevs[i]->port].sig >> 16) == 0xeb14)
adevs[i]->atapi = 1;
addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
grub_pci_write_word (addr, grub_pci_read_word (addr)
| GRUB_PCI_COMMAND_BUS_MASTER);
for (i = 0; i < nports; i++)
if (adevs[i])
{
@ -847,6 +861,12 @@ grub_ahci_reset_port (struct grub_ahci_device *dev, int force)
{
struct grub_disk_ata_pass_through_parms parms2;
dev->hba->ports[dev->port].command &= ~GRUB_AHCI_HBA_PORT_CMD_ST;
dev->hba->ports[dev->port].command_issue = 0;
dev->command_list[0].config = 0;
dev->command_table[0].prdt[0].unused = 0;
dev->command_table[0].prdt[0].size = 0;
dev->command_table[0].prdt[0].data_base = 0;
endtime = grub_get_time_ms () + 1000;
while ((dev->hba->ports[dev->port].command & GRUB_AHCI_HBA_PORT_CMD_CR))
if (grub_get_time_ms () > endtime)
@ -914,7 +934,10 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
if (parms->size > GRUB_AHCI_PRDT_MAX_CHUNK_LENGTH)
return grub_error (GRUB_ERR_BUG, "too big data buffer");
bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1));
if (parms->size)
bufc = grub_memalign_dma32 (1024, parms->size + (parms->size & 1));
else
bufc = grub_memalign_dma32 (1024, 512);
grub_dprintf ("ahci", "AHCI tfd = %x, CL=%p\n",
dev->hba->ports[dev->port].task_file_data,
@ -924,14 +947,14 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
= (5 << GRUB_AHCI_CONFIG_CFIS_LENGTH_SHIFT)
// | GRUB_AHCI_CONFIG_CLEAR_R_OK
| (0 << GRUB_AHCI_CONFIG_PMP_SHIFT)
| (1 << GRUB_AHCI_CONFIG_PRDT_LENGTH_SHIFT)
| ((parms->size ? 1 : 0) << GRUB_AHCI_CONFIG_PRDT_LENGTH_SHIFT)
| (parms->cmdsize ? GRUB_AHCI_CONFIG_ATAPI : 0)
| (parms->write ? GRUB_AHCI_CONFIG_WRITE : GRUB_AHCI_CONFIG_READ)
| (parms->taskfile.cmd == 8 ? (1 << 8) : 0);
grub_dprintf ("ahci", "AHCI tfd = %x\n",
dev->hba->ports[dev->port].task_file_data);
dev->command_list[0].transfered = 0;
dev->command_list[0].transferred = 0;
dev->command_list[0].command_table_base
= grub_dma_get_phys (dev->command_table_chunk);
@ -981,7 +1004,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
if (parms->write)
grub_memcpy ((char *) grub_dma_get_virt (bufc), parms->buffer, parms->size);
grub_dprintf ("ahci", "AHCI command schedulded\n");
grub_dprintf ("ahci", "AHCI command scheduled\n");
grub_dprintf ("ahci", "AHCI tfd = %x\n",
dev->hba->ports[dev->port].task_file_data);
grub_dprintf ("ahci", "AHCI inten = %x\n",
@ -1001,7 +1024,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
grub_dprintf ("ahci", "AHCI tfd = %x\n",
dev->hba->ports[dev->port].task_file_data);
endtime = grub_get_time_ms () + (spinup ? 10000 : 5000);
endtime = grub_get_time_ms () + (spinup ? 20000 : 20000);
while ((dev->hba->ports[dev->port].command_issue & 1))
if (grub_get_time_ms () > endtime)
{
@ -1021,7 +1044,7 @@ grub_ahci_readwrite_real (struct grub_ahci_device *dev,
dev->hba->ports[dev->port].command_issue,
dev->hba->ports[dev->port].intstatus,
dev->hba->ports[dev->port].task_file_data,
dev->command_list[0].transfered,
dev->command_list[0].transferred,
dev->hba->ports[dev->port].sata_error,
((grub_uint32_t *) grub_dma_get_virt (dev->rfis))[0x00],
((grub_uint32_t *) grub_dma_get_virt (dev->rfis))[0x18]);

Some files were not shown because too many files have changed in this diff Show More