mirror of
https://git.proxmox.com/git/grub2
synced 2025-08-04 00:12:09 +00:00
New upstream release.
This commit is contained in:
commit
2a89b38c7d
36
.bzrignore
36
.bzrignore
@ -28,12 +28,16 @@ docs/*.info
|
||||
docs/stamp-vti
|
||||
docs/version.texi
|
||||
*.elf
|
||||
example_grub_script_test
|
||||
example_scripted_test
|
||||
example_unit_test
|
||||
*.exec
|
||||
genkernsyms.sh
|
||||
gensymlist.sh
|
||||
gentrigtables
|
||||
grub-bin2h
|
||||
grub-dumpbios
|
||||
grub_cmd_echo
|
||||
grub_cmd_regexp
|
||||
grub-editenv
|
||||
grub-emu
|
||||
grub_emu_init.c
|
||||
@ -46,14 +50,34 @@ grub-kbdcomp
|
||||
grub-macho2img
|
||||
grub-menulst2cfg
|
||||
grub-mk*
|
||||
grub-mount
|
||||
grub-pe2elf
|
||||
grub-probe
|
||||
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_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_expansion
|
||||
grub_script_final_semicolon
|
||||
grub_script_for1
|
||||
grub_script_functions
|
||||
grub_script_if
|
||||
grub_script_not
|
||||
grub_script_return
|
||||
grub_script_setparams
|
||||
grub_script_shift
|
||||
grub_script_vars1
|
||||
grub_script_while1
|
||||
grub_script.tab.c
|
||||
grub_script.tab.h
|
||||
grub_script.yy.c
|
||||
@ -77,10 +101,13 @@ Makefile
|
||||
*.mod
|
||||
mod-*.c
|
||||
missing
|
||||
partmap_test
|
||||
*.pf2
|
||||
*.pp
|
||||
po/*.mo
|
||||
po/grub.pot
|
||||
po/POTFILES
|
||||
po/stamp-po
|
||||
stamp-h
|
||||
stamp-h1
|
||||
stamp-h.in
|
||||
@ -109,8 +136,11 @@ contrib
|
||||
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/modinfo.sh
|
||||
grub-core/*.module
|
||||
grub-core/*.pp
|
||||
util/bash-completion.d/grub
|
||||
@ -137,3 +167,7 @@ widthspec.bin
|
||||
widthspec.h
|
||||
docs/stamp-1
|
||||
docs/version-dev.texi
|
||||
Makefile.utilgcry.def
|
||||
po/*.po
|
||||
po/*.gmo
|
||||
po/LINGUAS
|
||||
|
174
Makefile.am
174
Makefile.am
@ -1,4 +1,4 @@
|
||||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
AUTOMAKE_OPTIONS = subdir-objects -Wno-portability
|
||||
|
||||
DEPDIR = .deps-util
|
||||
SUBDIRS = grub-core/gnulib . grub-core po docs util/bash-completion.d
|
||||
@ -62,10 +62,31 @@ CLEANFILES += grub_fstest_init.c
|
||||
|
||||
if COND_GRUB_MKFONT
|
||||
if COND_HAVE_FONT_SOURCE
|
||||
grubdata_DATA = unicode.pf2 ascii.pf2 euro.pf2 ascii.h widthspec.h
|
||||
pkgdata_DATA += unicode.pf2 ascii.pf2 euro.pf2 ascii.h widthspec.h
|
||||
endif
|
||||
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
|
||||
|
||||
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) grub-mkfont
|
||||
$(builddir)/grub-mkfont -s 10 -o $@ $(DJVU_FONT_SOURCE)
|
||||
dejavu_12.pf2: $(DJVU_FONT_SOURCE) grub-mkfont
|
||||
$(builddir)/grub-mkfont -s 12 -o $@ $(DJVU_FONT_SOURCE)
|
||||
dejavu_14.pf2: $(DJVU_FONT_SOURCE) grub-mkfont
|
||||
$(builddir)/grub-mkfont -s 14 -o $@ $(DJVU_FONT_SOURCE)
|
||||
dejavu_bold_14.pf2: $(DJVU_FONT_SOURCE) grub-mkfont
|
||||
$(builddir)/grub-mkfont -b -s 14 -o $@ $(DJVU_FONT_SOURCE)
|
||||
dejavu_16.pf2: $(DJVU_FONT_SOURCE) grub-mkfont
|
||||
$(builddir)/grub-mkfont -s 16 -o $@ $(DJVU_FONT_SOURCE)
|
||||
else
|
||||
starfield_DATA =
|
||||
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) grub-mkfont
|
||||
$(builddir)/grub-mkfont -o $@ $(FONT_SOURCE)
|
||||
CLEANFILES += unicode.pf2
|
||||
@ -101,43 +122,35 @@ CLEANFILES += widthspec.h
|
||||
# Install config.h into platformdir
|
||||
platform_HEADERS = config.h
|
||||
|
||||
pkglib_DATA += grub-mkconfig_lib
|
||||
pkglib_DATA += update-grub_lib
|
||||
pkgdata_DATA += grub-mkconfig_lib
|
||||
|
||||
|
||||
if COND_i386_coreboot
|
||||
BOOTTARGET=coreboot
|
||||
QEMU32=qemu-system-i386
|
||||
endif
|
||||
|
||||
if COND_i386_multiboot
|
||||
BOOTTARGET=cd
|
||||
QEMU32=qemu-system-i386
|
||||
endif
|
||||
|
||||
if COND_i386_ieee1275
|
||||
BOOTTARGET=cd
|
||||
QEMU32=qemu-system-i386
|
||||
endif
|
||||
|
||||
if COND_i386_qemu
|
||||
BOOTTARGET=qemu
|
||||
QEMU32=qemu-system-i386
|
||||
endif
|
||||
|
||||
if COND_i386_pc
|
||||
BOOTTARGET=cd
|
||||
QEMU32=qemu-system-i386
|
||||
endif
|
||||
|
||||
if COND_i386_efi
|
||||
QEMU32=qemu-system-i386
|
||||
BOOTTARGET=cd
|
||||
endif
|
||||
|
||||
if COND_x86_64_efi
|
||||
QEMU32=qemu-system-x86_64
|
||||
BOOTTARGET=cd
|
||||
endif
|
||||
|
||||
linux.init.x86_64: $(srcdir)/grub-core/tests/boot/linux.init-x86_64.S
|
||||
@ -146,6 +159,18 @@ linux.init.x86_64: $(srcdir)/grub-core/tests/boot/linux.init-x86_64.S
|
||||
linux.init.i386: $(srcdir)/grub-core/tests/boot/linux.init-i386.S
|
||||
$(TARGET_CC) -o $@ $< -m32 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
|
||||
|
||||
linux.init.mips: $(srcdir)/grub-core/tests/boot/linux.init-mips.S
|
||||
$(TARGET_CC) -o $@ $< -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
|
||||
|
||||
linux.init.ppc: $(srcdir)/grub-core/tests/boot/linux.init-ppc.S
|
||||
$(TARGET_CC) -o $@ $< -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
|
||||
|
||||
linux.init.mipsel: $(srcdir)/grub-core/tests/boot/linux.init-mips.S
|
||||
$(TARGET_CC) -o $@ $< -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
|
||||
|
||||
linux.init.loongson: $(srcdir)/grub-core/tests/boot/linux.init-mips.S
|
||||
$(TARGET_CC) -o $@ $< -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -DREBOOT=1
|
||||
|
||||
multiboot.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S
|
||||
$(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -DTARGET_MULTIBOOT=1 -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include
|
||||
|
||||
@ -153,19 +178,19 @@ kfreebsd.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S
|
||||
$(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include
|
||||
|
||||
kfreebsd.aout: kfreebsd.elf
|
||||
$(OBJCOPY) -O a.out-i386-linux $< $@ -R .note.gnu.build-id
|
||||
$(OBJCOPY) -O a.out-i386-linux $< $@ -R .note.gnu.build-id -R .note.gnu.gold-version
|
||||
|
||||
pc-chainloader.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S
|
||||
$(TARGET_CC) -o $@ $< -DTARGET_CHAINLOADER=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x7c00 -m32
|
||||
|
||||
pc-chainloader.bin: pc-chainloader.elf
|
||||
$(OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@;
|
||||
$(OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@;
|
||||
|
||||
ntldr.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S
|
||||
$(TARGET_CC) -o $@ $< -DTARGET_NTLDR=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0 -m32
|
||||
|
||||
ntldr.bin: ntldr.elf
|
||||
$(OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@;
|
||||
$(OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@;
|
||||
|
||||
multiboot2.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S
|
||||
$(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include -DTARGET_MULTIBOOT2=1
|
||||
@ -188,6 +213,18 @@ knetbsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kbsd.init-x86_64.S
|
||||
kopenbsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kbsd.init-x86_64.S
|
||||
$(TARGET_CC) -o $@ $< -m64 -DTARGET_OPENBSD=1 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
|
||||
|
||||
linux-initramfs.mips: linux.init.mips Makefile
|
||||
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR
|
||||
|
||||
linux-initramfs.ppc: linux.init.ppc Makefile
|
||||
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR
|
||||
|
||||
linux-initramfs.mipsel: linux.init.mipsel Makefile
|
||||
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR
|
||||
|
||||
linux-initramfs.loongson: linux.init.loongson Makefile
|
||||
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR
|
||||
|
||||
linux-initramfs.i386: linux.init.i386 Makefile
|
||||
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR
|
||||
|
||||
@ -224,97 +261,128 @@ kfreebsd-mfsroot.i386.gz: kfreebsd-mfsroot.i386.img
|
||||
gzip < $< > $@
|
||||
|
||||
bootcheck-kfreebsd-i386: kfreebsd-mfsroot.i386.gz $(GRUB_PAYLOADS_DIR)/kfreebsd.i386 $(GRUB_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/mfsroot.gz=kfreebsd-mfsroot.i386.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.i386 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/mfsroot.gz=kfreebsd-mfsroot.i386.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.i386 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
kfreebsd-mfsroot.x86_64.gz: kfreebsd-mfsroot.x86_64.img
|
||||
gzip < $< > $@
|
||||
|
||||
bootcheck-kfreebsd-x86_64: kfreebsd-mfsroot.x86_64.gz $(GRUB_PAYLOADS_DIR)/kfreebsd.x86_64 $(GRUB_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=qemu-system-x86_64 --files=/mfsroot.gz=kfreebsd-mfsroot.x86_64.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.x86_64 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/mfsroot.gz=kfreebsd-mfsroot.x86_64.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.x86_64 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
knetbsd.miniroot-image.i386.gz: knetbsd.miniroot-image.i386.img
|
||||
gzip < $< > $@
|
||||
|
||||
bootcheck-knetbsd-i386: knetbsd.miniroot-image.i386.gz $(GRUB_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/grub-core/tests/boot/knetbsd.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/miniroot.gz=knetbsd.miniroot-image.i386.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/miniroot.gz=knetbsd.miniroot-image.i386.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
bootcheck-kopenbsd-i386: kopenbsd.image.i386 $(GRUB_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/ramdisk=kopenbsd.image.i386 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/ramdisk=kopenbsd.image.i386 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
bootcheck-kopenbsd-x86_64: kopenbsd.image.x86_64 $(GRUB_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=qemu-system-x86_64 --files=/ramdisk=kopenbsd.image.x86_64 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/ramdisk=kopenbsd.image.x86_64 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
knetbsd.miniroot-image.x86_64.gz: knetbsd.miniroot-image.x86_64.img
|
||||
gzip < $< > $@
|
||||
|
||||
bootcheck-knetbsd-x86_64: knetbsd.miniroot-image.x86_64.gz $(GRUB_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/grub-core/tests/boot/knetbsd.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=qemu-system-x86_64 --files=/miniroot.gz=knetbsd.miniroot-image.x86_64.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/miniroot.gz=knetbsd.miniroot-image.x86_64.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
bootcheck-linux-i386: linux-initramfs.i386 $(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
bootcheck-linux-x86_64: linux-initramfs.x86_64 $(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
bootcheck-linux-mips: linux-initramfs.mips $(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.mips --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
bootcheck-linux-ppc: linux-initramfs.ppc $(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.ppc --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux-ppc.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
bootcheck-linux-mipsel: linux-initramfs.mipsel $(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.mipsel --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
bootcheck-linux-loongson: linux-initramfs.loongson $(GRUB_PAYLOADS_DIR)/linux.loongson $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --files=/initrd=linux-initramfs.loongson --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.loongson $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
bootcheck-linux16-i386: linux-initramfs.i386 $(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
bootcheck-linux16-x86_64: linux-initramfs.x86_64 $(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
bootcheck-multiboot: multiboot.elf $(srcdir)/grub-core/tests/boot/multiboot.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/multiboot.elf=multiboot.elf $(srcdir)/grub-core/tests/boot/multiboot.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/multiboot.elf=multiboot.elf $(srcdir)/grub-core/tests/boot/multiboot.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
bootcheck-multiboot2: multiboot2.elf $(srcdir)/grub-core/tests/boot/multiboot2.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/multiboot2.elf=multiboot2.elf $(srcdir)/grub-core/tests/boot/multiboot2.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/multiboot2.elf=multiboot2.elf $(srcdir)/grub-core/tests/boot/multiboot2.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
bootcheck-kfreebsd-aout: kfreebsd.aout $(srcdir)/grub-core/tests/boot/kfreebsd-aout.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/kfreebsd.aout=kfreebsd.aout $(srcdir)/grub-core/tests/boot/kfreebsd-aout.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/kfreebsd.aout=kfreebsd.aout $(srcdir)/grub-core/tests/boot/kfreebsd-aout.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
bootcheck-pc-chainloader: pc-chainloader.bin $(srcdir)/grub-core/tests/boot/pc-chainloader.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/pc-chainloader.bin=pc-chainloader.bin $(srcdir)/grub-core/tests/boot/pc-chainloader.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/pc-chainloader.bin=pc-chainloader.bin $(srcdir)/grub-core/tests/boot/pc-chainloader.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
bootcheck-ntldr: ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg grub-shell
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu-opts="$(GRUB_QEMU_OPTS)" --boot=$(BOOTTARGET) --qemu=$(QEMU32) --files=/ntldr.bin=ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
timeout -s KILL $(BOOTCHECK_TIMEOUT) ./grub-shell --qemu=$(QEMU32) --files=/ntldr.bin=ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
|
||||
|
||||
BOOTCHECKS=
|
||||
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
|
||||
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
|
||||
endif
|
||||
|
||||
if COND_i386_multiboot
|
||||
# Freebsd crashes because memory at 0-0x1000 is occupied and 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_coreboot
|
||||
# 64-bit NetBSD crashes because memory at 0-0x1000 is occupied
|
||||
# Freebsd crashes because memory at 0-0x1000 is occupied and requires ACPI
|
||||
BOOTCHECKS = bootcheck-kfreebsd-aout bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64 bootcheck-multiboot bootcheck-multiboot2 bootcheck-linux-i386 bootcheck-linux-x86_64
|
||||
endif
|
||||
|
||||
if COND_i386_qemu
|
||||
# Freebsd crashes because memory at 0-0x1000 is occupied and 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_pc
|
||||
#pc chainloader by definition is only for i386-pc
|
||||
BOOTCHECKS += bootcheck-pc-chainloader
|
||||
#ntldr and bootmgr require BIOS.
|
||||
BOOTCHECKS += bootcheck-ntldr
|
||||
#legacy protocol makes early BIOS calls.
|
||||
BOOTCHECKS += bootcheck-linux16-i386 bootcheck-linux16-x86_64
|
||||
# Crashes early on non-BIOS
|
||||
BOOTCHECKS += bootcheck-knetbsd-i386
|
||||
# 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
|
||||
|
||||
if !COND_i386_coreboot
|
||||
# Crashes because memory at 0-0x1000 is occupied
|
||||
BOOTCHECKS += bootcheck-knetbsd-x86_64
|
||||
|
||||
# Likewise and require ACPI.
|
||||
if !COND_i386_multiboot
|
||||
if !COND_i386_qemu
|
||||
BOOTCHECKS += bootcheck-kfreebsd-x86_64
|
||||
BOOTCHECKS += bootcheck-kfreebsd-i386
|
||||
endif
|
||||
endif
|
||||
if COND_mips_loongson
|
||||
BOOTCHECKS = bootcheck-linux-loongson
|
||||
endif
|
||||
|
||||
BOOTCHECKS += bootcheck-kfreebsd-aout
|
||||
if COND_mipsel
|
||||
if COND_mips_qemu_mips
|
||||
BOOTCHECKS = bootcheck-linux-mipsel
|
||||
endif
|
||||
endif
|
||||
if COND_mipseb
|
||||
if COND_mips_qemu_mips
|
||||
BOOTCHECKS = bootcheck-linux-mips
|
||||
endif
|
||||
endif
|
||||
|
||||
BOOTCHECKS += bootcheck-kopenbsd-i386 bootcheck-kopenbsd-x86_64
|
||||
|
||||
BOOTCHECKS += bootcheck-multiboot bootcheck-multiboot2
|
||||
|
||||
BOOTCHECKS += bootcheck-linux-i386 bootcheck-linux-x86_64
|
||||
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-x86_64.S 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
|
||||
|
||||
.PHONY: bootcheck-linux-i386 bootcheck-linux-x86_64 \
|
||||
bootcheck-kfreebsd-i386 bootcheck-kfreebsd-x86_64 \
|
||||
bootcheck-knetbsd-i386 bootcheck-knetbsd-x86_64
|
||||
bootcheck-knetbsd-i386 bootcheck-knetbsd-x86_64 \
|
||||
bootcheck-linux-mips
|
||||
|
||||
# Randomly generated
|
||||
SUCCESSFUL_BOOT_STRING=3e49994fd5d82b7c9298d672d774080d
|
||||
|
@ -9,7 +9,8 @@ library = {
|
||||
common = grub-core/kern/command.c;
|
||||
common = grub-core/kern/device.c;
|
||||
common = grub-core/kern/disk.c;
|
||||
common = grub-core/kern/emu/getroot.c;
|
||||
common = util/getroot.c;
|
||||
common = util/raid.c;
|
||||
common = grub-core/kern/emu/hostdisk.c;
|
||||
common = grub-core/kern/emu/misc.c;
|
||||
common = grub-core/kern/emu/mm.c;
|
||||
@ -20,12 +21,23 @@ library = {
|
||||
common = grub-core/kern/list.c;
|
||||
common = grub-core/kern/misc.c;
|
||||
common = grub-core/kern/partition.c;
|
||||
common = grub-core/lib/crypto.c;
|
||||
common = grub-core/disk/luks.c;
|
||||
common = grub-core/disk/geli.c;
|
||||
common = grub-core/disk/cryptodisk.c;
|
||||
common = grub-core/disk/AFSplitter.c;
|
||||
common = grub-core/lib/pbkdf2.c;
|
||||
common = grub-core/commands/extcmd.c;
|
||||
common = grub-core/lib/arg.c;
|
||||
common = grub-core/disk/ldm.c;
|
||||
common = grub-core/disk/diskfilter.c;
|
||||
common = grub-core/partmap/gpt.c;
|
||||
};
|
||||
|
||||
library = {
|
||||
name = libgrubmods.a;
|
||||
cflags = '$(CFLAGS_GCRY)';
|
||||
cppflags = '$(CPPFLAGS_GCRY)';
|
||||
cflags = '$(CFLAGS_POSIX) -Wno-undef -Wno-error=missing-noreturn';
|
||||
cppflags = '-I$(top_srcdir)/grub-core/lib/minilzo -I$(srcdir)/grub-core/lib/xzembed -DMINILZO_HAVE_CONFIG_H';
|
||||
|
||||
common_nodist = grub_script.tab.c;
|
||||
common_nodist = grub_script.yy.c;
|
||||
@ -34,25 +46,28 @@ library = {
|
||||
common_nodist = grub_script.tab.h;
|
||||
|
||||
common = grub-core/commands/blocklist.c;
|
||||
common = grub-core/commands/extcmd.c;
|
||||
common = grub-core/commands/xnu_uuid.c;
|
||||
common = grub-core/commands/testload.c;
|
||||
common = grub-core/commands/ls.c;
|
||||
common = grub-core/disk/dmraid_nvidia.c;
|
||||
common = grub-core/disk/loopback.c;
|
||||
common = grub-core/disk/lvm.c;
|
||||
common = grub-core/disk/mdraid_linux.c;
|
||||
common = grub-core/disk/mdraid_linux_be.c;
|
||||
common = grub-core/disk/mdraid1x_linux.c;
|
||||
common = grub-core/disk/raid5_recover.c;
|
||||
common = grub-core/disk/raid6_recover.c;
|
||||
common = grub-core/disk/raid.c;
|
||||
common = grub-core/fs/affs.c;
|
||||
common = grub-core/fs/afs_be.c;
|
||||
common = grub-core/fs/afs.c;
|
||||
common = grub-core/fs/befs_be.c;
|
||||
common = grub-core/fs/befs.c;
|
||||
common = grub-core/fs/bfs.c;
|
||||
common = grub-core/fs/btrfs.c;
|
||||
common = grub-core/fs/cpio.c;
|
||||
common = grub-core/fs/cpio_be.c;
|
||||
common = grub-core/fs/odc.c;
|
||||
common = grub-core/fs/newc.c;
|
||||
common = grub-core/fs/ext2.c;
|
||||
common = grub-core/fs/fat.c;
|
||||
common = grub-core/fs/exfat.c;
|
||||
common = grub-core/fs/fshelp.c;
|
||||
common = grub-core/fs/hfs.c;
|
||||
common = grub-core/fs/hfsplus.c;
|
||||
@ -60,38 +75,44 @@ library = {
|
||||
common = grub-core/fs/jfs.c;
|
||||
common = grub-core/fs/minix.c;
|
||||
common = grub-core/fs/minix2.c;
|
||||
common = grub-core/fs/minix3.c;
|
||||
common = grub-core/fs/minix_be.c;
|
||||
common = grub-core/fs/minix2_be.c;
|
||||
common = grub-core/fs/minix3_be.c;
|
||||
common = grub-core/fs/nilfs2.c;
|
||||
common = grub-core/fs/ntfs.c;
|
||||
common = grub-core/fs/ntfscomp.c;
|
||||
common = grub-core/fs/reiserfs.c;
|
||||
common = grub-core/fs/romfs.c;
|
||||
common = grub-core/fs/sfs.c;
|
||||
common = grub-core/fs/squash4.c;
|
||||
common = grub-core/fs/tar.c;
|
||||
common = grub-core/fs/udf.c;
|
||||
common = grub-core/fs/ufs2.c;
|
||||
common = grub-core/fs/ufs.c;
|
||||
common = grub-core/fs/xfs.c;
|
||||
common = grub-core/fs/zfs/zfscrypt.c;
|
||||
common = grub-core/fs/zfs/zfs.c;
|
||||
common = grub-core/fs/zfs/zfsinfo.c;
|
||||
common = grub-core/fs/zfs/zfs_lzjb.c;
|
||||
common = grub-core/fs/zfs/zfs_sha256.c;
|
||||
common = grub-core/fs/zfs/zfs_fletcher.c;
|
||||
common = grub-core/lib/arg.c;
|
||||
common = grub-core/lib/crypto.c;
|
||||
common = grub-core/lib/envblk.c;
|
||||
common = grub-core/lib/hexdump.c;
|
||||
common = grub-core/lib/libgcrypt-grub/cipher/sha512.c;
|
||||
common = grub-core/lib/libgcrypt-grub/cipher/crc.c;
|
||||
common = grub-core/lib/LzFind.c;
|
||||
common = grub-core/lib/LzmaEnc.c;
|
||||
common = grub-core/lib/pbkdf2.c;
|
||||
common = grub-core/lib/crc.c;
|
||||
common = grub-core/lib/adler32.c;
|
||||
common = grub-core/lib/crc64.c;
|
||||
common = grub-core/normal/datetime.c;
|
||||
common = grub-core/normal/misc.c;
|
||||
common = grub-core/partmap/acorn.c;
|
||||
common = grub-core/partmap/amiga.c;
|
||||
common = grub-core/partmap/apple.c;
|
||||
common = grub-core/partmap/gpt.c;
|
||||
common = grub-core/partmap/msdos.c;
|
||||
common = grub-core/partmap/sun.c;
|
||||
common = grub-core/partmap/plan.c;
|
||||
common = grub-core/partmap/dvh.c;
|
||||
common = grub-core/partmap/sunpc.c;
|
||||
common = grub-core/partmap/bsdlabel.c;
|
||||
common = grub-core/script/function.c;
|
||||
@ -100,16 +121,23 @@ library = {
|
||||
common = grub-core/script/script.c;
|
||||
common = grub-core/script/argv.c;
|
||||
common = grub-core/io/gzio.c;
|
||||
common = grub-core/io/lzopio.c;
|
||||
common = grub-core/kern/ia64/dl_helper.c;
|
||||
common = grub-core/lib/minilzo/minilzo.c;
|
||||
common = grub-core/lib/xzembed/xz_dec_bcj.c;
|
||||
common = grub-core/lib/xzembed/xz_dec_lzma2.c;
|
||||
common = grub-core/lib/xzembed/xz_dec_stream.c;
|
||||
};
|
||||
|
||||
program = {
|
||||
name = grub-bin2h;
|
||||
common = util/bin2h.c;
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
||||
mansection = 1;
|
||||
installdir = noinst;
|
||||
};
|
||||
|
||||
program = {
|
||||
@ -118,14 +146,17 @@ program = {
|
||||
|
||||
common = util/grub-mkimage.c;
|
||||
common = util/resolve.c;
|
||||
common = grub-core/kern/emu/argp_common.c;
|
||||
|
||||
extra_dist = util/grub-mkimagexx.c;
|
||||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBLZMA)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
cppflags = '-DGRUB_PKGLIBROOTDIR=\"$(pkglibrootdir)\"';
|
||||
cppflags = '-DGRUB_PKGLIBDIR=\"$(pkglibdir)\"';
|
||||
};
|
||||
|
||||
program = {
|
||||
@ -133,11 +164,13 @@ program = {
|
||||
mansection = 1;
|
||||
|
||||
common = util/grub-mkrelpath.c;
|
||||
common = grub-core/kern/emu/argp_common.c;
|
||||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
};
|
||||
|
||||
program = {
|
||||
@ -145,8 +178,10 @@ program = {
|
||||
mansection = 1;
|
||||
|
||||
common = util/grub-script-check.c;
|
||||
common = grub-core/kern/emu/argp_common.c;
|
||||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
@ -159,6 +194,7 @@ program = {
|
||||
common = util/grub-editenv.c;
|
||||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
@ -169,8 +205,10 @@ program = {
|
||||
mansection = 1;
|
||||
|
||||
common = util/grub-mkpasswd-pbkdf2.c;
|
||||
common = grub-core/kern/emu/argp_common.c;
|
||||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
@ -191,6 +229,7 @@ program = {
|
||||
common = util/grub-pe2elf.c;
|
||||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL)';
|
||||
@ -209,9 +248,26 @@ program = {
|
||||
cppflags = '$(CPPFLAGS_GCRY)';
|
||||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
};
|
||||
|
||||
program = {
|
||||
name = grub-mount;
|
||||
mansection = 1;
|
||||
common_nodist = grub_fstest_init.c;
|
||||
common = util/grub-mount.c;
|
||||
common = grub-core/kern/emu/hostfs.c;
|
||||
common = grub-core/disk/host.c;
|
||||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) -lfuse';
|
||||
condition = COND_GRUB_MOUNT;
|
||||
};
|
||||
|
||||
program = {
|
||||
@ -219,10 +275,12 @@ program = {
|
||||
mansection = 1;
|
||||
common = util/grub-mkfont.c;
|
||||
common = grub-core/unidata.c;
|
||||
common = grub-core/kern/emu/argp_common.c;
|
||||
|
||||
cflags = '$(freetype_cflags)';
|
||||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(freetype_libs)';
|
||||
@ -230,68 +288,68 @@ program = {
|
||||
condition = COND_GRUB_MKFONT;
|
||||
};
|
||||
|
||||
program = {
|
||||
name = grub-mkdevicemap;
|
||||
installdir = sbin;
|
||||
mansection = 8;
|
||||
|
||||
common = util/grub-mkdevicemap.c;
|
||||
common = util/deviceiter.c;
|
||||
nosparc64 = util/devicemap.c;
|
||||
|
||||
sparc64_ieee1275 = util/ieee1275/ofpath.c;
|
||||
sparc64_ieee1275 = util/ieee1275/devicemap.c;
|
||||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
};
|
||||
|
||||
program = {
|
||||
name = grub-probe;
|
||||
installdir = sbin;
|
||||
mansection = 8;
|
||||
common = util/grub-probe.c;
|
||||
common = util/ieee1275/ofpath.c;
|
||||
common = grub-core/kern/emu/argp_common.c;
|
||||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
};
|
||||
|
||||
program = {
|
||||
name = grub-setup;
|
||||
name = grub-bios-setup;
|
||||
installdir = sbin;
|
||||
mansection = 8;
|
||||
common = util/grub-setup.c;
|
||||
common = util/raid.c;
|
||||
common = util/lvm.c;
|
||||
common = grub-core/kern/emu/argp_common.c;
|
||||
common = grub-core/lib/reed_solomon.c;
|
||||
|
||||
sparc64_ieee1275 = util/ieee1275/ofpath.c;
|
||||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
cppflags = '-DGRUB_SETUP_BIOS=1';
|
||||
};
|
||||
|
||||
enable = i386_pc;
|
||||
enable = sparc64_ieee1275;
|
||||
program = {
|
||||
name = grub-sparc64-setup;
|
||||
installdir = sbin;
|
||||
mansection = 8;
|
||||
common = util/grub-setup.c;
|
||||
common = util/lvm.c;
|
||||
common = grub-core/kern/emu/argp_common.c;
|
||||
common = grub-core/lib/reed_solomon.c;
|
||||
common = util/ieee1275/ofpath.c;
|
||||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
cppflags = '-DGRUB_SETUP_SPARC64=1';
|
||||
};
|
||||
|
||||
program = {
|
||||
name = grub-ofpathname;
|
||||
installdir = sbin;
|
||||
ieee1275 = util/ieee1275/grub-ofpathname.c;
|
||||
ieee1275 = util/ieee1275/ofpath.c;
|
||||
mansection = 8;
|
||||
common = util/ieee1275/grub-ofpathname.c;
|
||||
common = util/ieee1275/ofpath.c;
|
||||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBGEOM)';
|
||||
|
||||
enable = sparc64_ieee1275;
|
||||
};
|
||||
|
||||
program = {
|
||||
@ -299,8 +357,10 @@ program = {
|
||||
mansection = 1;
|
||||
|
||||
common = util/grub-mklayout.c;
|
||||
common = grub-core/kern/emu/argp_common.c;
|
||||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
@ -338,6 +398,13 @@ script = {
|
||||
condition = COND_HOST_KFREEBSD;
|
||||
};
|
||||
|
||||
script = {
|
||||
name = '10_illumos';
|
||||
common = util/grub.d/10_illumos.in;
|
||||
installdir = grubconf;
|
||||
condition = COND_HOST_ILLUMOS;
|
||||
};
|
||||
|
||||
script = {
|
||||
name = '10_netbsd';
|
||||
common = util/grub.d/10_netbsd.in;
|
||||
@ -352,6 +419,13 @@ script = {
|
||||
condition = COND_HOST_LINUX;
|
||||
};
|
||||
|
||||
script = {
|
||||
name = '10_xnu';
|
||||
common = util/grub.d/10_xnu.in;
|
||||
installdir = grubconf;
|
||||
condition = COND_HOST_XNU;
|
||||
};
|
||||
|
||||
script = {
|
||||
name = '20_linux_xen';
|
||||
common = util/grub.d/20_linux_xen.in;
|
||||
@ -381,15 +455,28 @@ script = {
|
||||
mansection = 1;
|
||||
name = grub-mkrescue;
|
||||
x86 = util/grub-mkrescue.in;
|
||||
mips_qemu_mips = util/grub-mkrescue.in;
|
||||
mips_loongson = util/grub-mkrescue.in;
|
||||
ia64_efi = util/grub-mkrescue.in;
|
||||
powerpc_ieee1275 = util/powerpc/ieee1275/grub-mkrescue.in;
|
||||
enable = i386_pc;
|
||||
enable = x86_efi;
|
||||
enable = i386_efi;
|
||||
enable = x86_64_efi;
|
||||
enable = i386_qemu;
|
||||
enable = i386_multiboot;
|
||||
enable = i386_coreboot;
|
||||
enable = mips_qemu_mips;
|
||||
enable = mips_loongson;
|
||||
enable = ia64_efi;
|
||||
enable = powerpc_ieee1275;
|
||||
};
|
||||
|
||||
script = {
|
||||
mansection = 1;
|
||||
name = grub-mkstandalone;
|
||||
common = util/grub-mkstandalone.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
mansection = 8;
|
||||
installdir = sbin;
|
||||
@ -434,15 +521,10 @@ script = {
|
||||
installdir = noinst;
|
||||
};
|
||||
|
||||
script = {
|
||||
name = update-grub_lib;
|
||||
common = util/update-grub_lib.in;
|
||||
installdir = noinst;
|
||||
};
|
||||
|
||||
script = {
|
||||
name = grub-kbdcomp;
|
||||
common = util/grub-kbdcomp.in;
|
||||
mansection = 1;
|
||||
};
|
||||
|
||||
script = {
|
||||
@ -475,6 +557,12 @@ script = {
|
||||
common = tests/grub_script_echo1.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = grub_script_leading_whitespace;
|
||||
common = tests/grub_script_leading_whitespace.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = grub_script_echo_keywords;
|
||||
@ -601,6 +689,18 @@ script = {
|
||||
common = tests/grub_cmd_echo.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = grub_script_gettext;
|
||||
common = tests/grub_script_gettext.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
testcase;
|
||||
name = grub_script_strcmp;
|
||||
common = tests/grub_script_strcmp.in;
|
||||
};
|
||||
|
||||
program = {
|
||||
testcase;
|
||||
name = example_unit_test;
|
||||
@ -609,8 +709,38 @@ program = {
|
||||
common = grub-core/kern/list.c;
|
||||
common = grub-core/kern/misc.c;
|
||||
common = grub-core/tests/lib/test.c;
|
||||
cflags = -Wno-format;
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
};
|
||||
|
||||
program = {
|
||||
testcase;
|
||||
name = printf_test;
|
||||
common = tests/printf_unit_test.c;
|
||||
common = tests/lib/unit_test.c;
|
||||
common = grub-core/kern/list.c;
|
||||
common = grub-core/kern/misc.c;
|
||||
common = grub-core/tests/lib/test.c;
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
};
|
||||
|
||||
program = {
|
||||
testcase;
|
||||
name = cmp_test;
|
||||
common = tests/cmp_unit_test.c;
|
||||
common = tests/lib/unit_test.c;
|
||||
common = grub-core/kern/list.c;
|
||||
common = grub-core/kern/misc.c;
|
||||
common = grub-core/tests/lib/test.c;
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
@ -624,6 +754,7 @@ program = {
|
||||
common = grub-core/lib/i386/pc/vesa_modes_table.c;
|
||||
|
||||
ldadd = libgrubmods.a;
|
||||
ldadd = libgrubgcry.a;
|
||||
ldadd = libgrubkern.a;
|
||||
ldadd = grub-core/gnulib/libgnu.a;
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
|
126
NEWS
126
NEWS
@ -1,3 +1,129 @@
|
||||
New in 2.00:
|
||||
|
||||
* Appearence:
|
||||
* Official theme for gfxmenu (starfield)
|
||||
* Menu is organised with submenus.
|
||||
* Better default video mode selection using EDID.
|
||||
|
||||
* New platforms:
|
||||
* Itanium port.
|
||||
* Fuloong2F support (including GRUB as firmware)
|
||||
* Fuloong2E support (except GRUB as firmware)
|
||||
* ARCS (SGI machines) port.
|
||||
* qemu -M mips port.
|
||||
|
||||
* grub-mount to mount filesystems using GRUB FS drivers and FUSE.
|
||||
|
||||
* Changed security default so entries are locked by default if any superuser is
|
||||
defined.
|
||||
|
||||
* New drivers:
|
||||
* EHCI.
|
||||
* AHCI.
|
||||
* ESCC serial.
|
||||
* 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.
|
||||
* Plan9 partition map.
|
||||
* Big-endian mdraid.
|
||||
* Big-endian cpio.
|
||||
* ODC and NEWC cpio.
|
||||
* ExFAT.
|
||||
* Minix3fs.
|
||||
* Big-endian minixfs.
|
||||
* RomFS.
|
||||
* Squash4.
|
||||
* Support non-512B disk blocks.
|
||||
* LUKS and GELI support.
|
||||
* LDM read support (no install yet).
|
||||
* LZOP.
|
||||
|
||||
* Improved filesystem and disks formats support:
|
||||
* HFS+ label support.
|
||||
* Improved reiserfs support.
|
||||
* multidevice, mirrored and raidz(2,3) ZFS support.
|
||||
* RAID LVM (internal RAIDing) support.
|
||||
* ZFS crypto support.
|
||||
* ZLE 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.
|
||||
* Improved AFFS and SFS support.
|
||||
* LZO-compressed btrfs support.
|
||||
* cpio and tar symlinks support.
|
||||
* Better FS detection to reduce false positives.
|
||||
|
||||
* New boot protocols:
|
||||
* Ability to load another coreboot payload when on coreboot.
|
||||
* Plan9.
|
||||
* Freedos.
|
||||
* Ntldr/bootmgr (to load Windows bootloader).
|
||||
* chainloader --bpb support to patch FAT or NTFS BPB in memory to correct
|
||||
wrong partition offset.
|
||||
* PXE chainloading support.
|
||||
* Darwin 11 (Mac OS X Lion) protocol support.
|
||||
|
||||
* Boot protocol improvements:
|
||||
* Multiple initrd support.
|
||||
* Basic illumos and xnu autoconfig.
|
||||
|
||||
* Testing and debugging:
|
||||
* New grub-fstest commands: cat, zfsinfo, testload xnu_uuid
|
||||
* grub-fstest recursive directory compare for quickly checking that
|
||||
a directory is read correctly.
|
||||
* Backtace on crash (if gdb module is loaded, x86 only)
|
||||
* Disk cache statistics gathering.
|
||||
* GDB stub and GDB support script.
|
||||
* "make check" and "make bootcheck" expanded to almost all platforms
|
||||
(except i386-ieee1275, mips-arc, sparc64-ieee1275, ia64-efi and emu)
|
||||
* New `time' command.
|
||||
|
||||
* Performance:
|
||||
* Lazy scanning to avoid accessing devices which aren't really used.
|
||||
This avoids boot delay due to slow device scanning.
|
||||
* Use CPU cache when accessing video memory.
|
||||
* Search hints to first try the most likely device when searching for a
|
||||
device with given UUID. This avoids slow scanning in most cases.
|
||||
|
||||
* Internationalisation:
|
||||
* Updated to Unicode 6.0.
|
||||
* $"..." syntax for translation in grub scripting language. This allows easy
|
||||
translation of grub.cfg at runtime.
|
||||
* Translations to many languages included in official distribution.
|
||||
|
||||
* Scripting:
|
||||
* $grub_cpu and $grub_platform variables for conditioning grub.cfg on platform
|
||||
at runtime.
|
||||
* $feature_* variables to condition scripts on available features.
|
||||
* Use of ids to identify menu entries.
|
||||
* all_video module which is empty but depends on all video modules thus
|
||||
allowing easy loading of all of them.
|
||||
|
||||
* Installation:
|
||||
* grub-mknetdir script for easy creation of netbootable GRUB directory.
|
||||
* Itanium and mips support in grub-mkrescue.
|
||||
* grub-install support for all platforms except emu.
|
||||
* PreP partition install support.
|
||||
* No files conflict between flavours (except grub-mkrescue for ppc). This
|
||||
allows easy install of GRUB for several platforms.
|
||||
* grub-mkstandalone script for easy creating of image including all modules
|
||||
for platforms with generous limit on image size.
|
||||
* program-transform-name now functions according to usual conventions.
|
||||
Use --grubdir and --bootdir to get old behaviour.
|
||||
|
||||
* ADLER32 and CRC64 support (for XZ and hashsum).
|
||||
|
||||
* ofconsole renamed to console
|
||||
|
||||
* Experimental support for compiling with Apple toolchain.
|
||||
|
||||
* grub-mkdevicemap removed. Now all devices are detected on invocation of
|
||||
any grub utility.
|
||||
|
||||
New in 1.99:
|
||||
|
||||
* Keyboard layouts support.
|
||||
|
44
acinclude.m4
44
acinclude.m4
@ -316,14 +316,14 @@ fi
|
||||
dnl Check if the C compiler generates calls to `__enable_execute_stack()'.
|
||||
AC_DEFUN([grub_CHECK_ENABLE_EXECUTE_STACK],[
|
||||
AC_MSG_CHECKING([whether `$CC' generates calls to `__enable_execute_stack()'])
|
||||
AC_LANG_CONFTEST([[
|
||||
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
||||
void f (int (*p) (void));
|
||||
void g (int i)
|
||||
{
|
||||
int nestedfunc (void) { return i; }
|
||||
f (nestedfunc);
|
||||
}
|
||||
]])
|
||||
]])])
|
||||
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -S conftest.c]) && test -s conftest.s; then
|
||||
true
|
||||
else
|
||||
@ -346,7 +346,9 @@ AC_DEFUN([grub_CHECK_STACK_PROTECTOR],[
|
||||
ssp_possible=yes]
|
||||
AC_MSG_CHECKING([whether `$CC' accepts `-fstack-protector'])
|
||||
# Is this a reliable test case?
|
||||
AC_LANG_CONFTEST([[void foo (void) { volatile char a[8]; a[3]; }]])
|
||||
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
||||
void foo (void) { volatile char a[8]; a[3]; }
|
||||
]])])
|
||||
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
|
||||
# `ac_compile' like this correct, after all?
|
||||
if eval "$ac_compile -S -fstack-protector -o conftest.s" 2> /dev/null; then]
|
||||
@ -364,7 +366,9 @@ AC_DEFUN([grub_CHECK_STACK_ARG_PROBE],[
|
||||
[# Smashing stack arg probe.
|
||||
sap_possible=yes]
|
||||
AC_MSG_CHECKING([whether `$CC' accepts `-mstack-arg-probe'])
|
||||
AC_LANG_CONFTEST([[void foo (void) { volatile char a[8]; a[3]; }]])
|
||||
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
||||
void foo (void) { volatile char a[8]; a[3]; }
|
||||
]])])
|
||||
[if eval "$ac_compile -S -mstack-arg-probe -o conftest.s" 2> /dev/null; then]
|
||||
AC_MSG_RESULT([yes])
|
||||
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
|
||||
@ -399,7 +403,7 @@ AC_DEFUN([grub_CHECK_PIE],[
|
||||
pie_possible=yes]
|
||||
AC_MSG_CHECKING([whether `$CC' has `-fPIE' as default])
|
||||
# Is this a reliable test case?
|
||||
AC_LANG_CONFTEST([[
|
||||
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
||||
#ifdef __PIE__
|
||||
int main() {
|
||||
return 0;
|
||||
@ -407,7 +411,7 @@ int main() {
|
||||
#else
|
||||
#error NO __PIE__ DEFINED
|
||||
#endif
|
||||
]])
|
||||
]])])
|
||||
|
||||
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
|
||||
# `ac_compile' like this correct, after all?
|
||||
@ -420,3 +424,31 @@ else
|
||||
AC_MSG_RESULT([no])
|
||||
[fi]
|
||||
])
|
||||
|
||||
dnl Check if the C compiler supports `-fPIC'.
|
||||
AC_DEFUN([grub_CHECK_PIC],[
|
||||
[# Position independent executable.
|
||||
pic_possible=yes]
|
||||
AC_MSG_CHECKING([whether `$CC' has `-fPIC' as default])
|
||||
# Is this a reliable test case?
|
||||
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
||||
#ifdef __PIC__
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#error NO __PIC__ DEFINED
|
||||
#endif
|
||||
]])])
|
||||
|
||||
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
|
||||
# `ac_compile' like this correct, after all?
|
||||
if eval "$ac_compile -S -o conftest.s" 2> /dev/null; then]
|
||||
AC_MSG_RESULT([yes])
|
||||
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
|
||||
rm -f conftest.s
|
||||
else
|
||||
pic_possible=no]
|
||||
AC_MSG_RESULT([no])
|
||||
[fi]
|
||||
])
|
||||
|
@ -26,7 +26,7 @@ if [ "x${GRUB_CONTRIB}" != x ]; then
|
||||
[ "${GRUB_CONTRIB}" = grub-core/contrib ] || ln -s ../contrib grub-core/contrib
|
||||
fi
|
||||
|
||||
UTIL_DEFS=Makefile.util.def
|
||||
UTIL_DEFS='Makefile.util.def Makefile.utilgcry.def'
|
||||
CORE_DEFS='grub-core/Makefile.core.def grub-core/Makefile.gcry.def'
|
||||
|
||||
for extra in contrib/*/Makefile.util.def; do
|
||||
|
@ -11,10 +11,10 @@ if COND_i386_pc
|
||||
CFLAGS_PLATFORM += -mrtd -mregparm=3
|
||||
endif
|
||||
if COND_i386_efi
|
||||
LDFLAGS_PLATFORM = -melf_i386
|
||||
LDFLAGS_PLATFORM = -Wl,-melf_i386
|
||||
endif
|
||||
if COND_x86_64_efi
|
||||
LDFLAGS_PLATFORM = -melf_x86_64
|
||||
LDFLAGS_PLATFORM = -Wl,-melf_x86_64
|
||||
endif
|
||||
if COND_i386_qemu
|
||||
CFLAGS_PLATFORM += -mrtd -mregparm=3
|
||||
@ -25,17 +25,17 @@ endif
|
||||
if COND_i386_ieee1275
|
||||
CFLAGS_PLATFORM += -mrtd -mregparm=3
|
||||
endif
|
||||
if COND_mips_yeeloong
|
||||
if COND_mips_loongson
|
||||
CFLAGS_PLATFORM += -mexplicit-relocs
|
||||
CPPFLAGS_PLATFORM = -DUSE_ASCII_FAILBACK
|
||||
CCASFLAGS_PLATFORM = -march=mips3
|
||||
endif
|
||||
if COND_mips
|
||||
CFLAGS_PLATFORM += -mflush-func=grub_cpu_flush_cache
|
||||
CCASFLAGS_PLATFORM = -march=mips3
|
||||
endif
|
||||
if COND_sparc64_ieee1275
|
||||
CFLAGS_PLATFORM += -mno-app-regs
|
||||
LDFLAGS_PLATFORM = -melf64_sparc -mno-relax
|
||||
LDFLAGS_PLATFORM = -Wl,-melf64_sparc -mno-relax
|
||||
endif
|
||||
|
||||
# Other options
|
||||
@ -68,22 +68,22 @@ endif
|
||||
endif
|
||||
|
||||
CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
|
||||
LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N -static-libgcc
|
||||
LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -static-libgcc
|
||||
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
|
||||
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
||||
if COND_CYGWIN
|
||||
STRIPFLAGS_KERNEL = -F elf32-i386 -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve
|
||||
STRIPFLAGS_KERNEL = -F elf32-i386 -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve -R .note.gnu.gold-version
|
||||
else
|
||||
STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment
|
||||
STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment -R .note.gnu.gold-version
|
||||
endif
|
||||
|
||||
CFLAGS_MODULE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
|
||||
LDFLAGS_MODULE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-r,-d
|
||||
LDFLAGS_MODULE = $(LDFLAGS_CPU) $(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 -Wl,-N,-S
|
||||
LDFLAGS_IMAGE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib $(TARGET_LDFLAGS_OLDMAGIC) -Wl,-S
|
||||
CPPFLAGS_IMAGE = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
|
||||
CCASFLAGS_IMAGE = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
||||
|
||||
@ -99,13 +99,13 @@ CCASFLAGS_LIBRARY =
|
||||
# Other variables
|
||||
|
||||
grubconfdir = $(sysconfdir)/grub.d
|
||||
grubdatadir = $(datadir)/`echo @PACKAGE_TARNAME@ | sed '$(transform)'`
|
||||
platformdir = $(pkglibrootdir)/$(target_cpu)-$(platform)
|
||||
platformdir = $(pkglibdir)/$(target_cpu)-$(platform)
|
||||
starfielddir = $(pkgdatadir)/themes/starfield
|
||||
|
||||
CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers
|
||||
CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap
|
||||
|
||||
CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter
|
||||
CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter -Wno-redundant-decls -Wno-unreachable-code -Wno-conversion -Wno-old-style-definition -Wno-unsafe-loop-optimizations
|
||||
CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/gnulib -I$(top_srcdir)/grub-core/gnulib
|
||||
|
||||
CFLAGS_POSIX = -fno-builtin
|
||||
@ -137,7 +137,7 @@ KERNEL_HEADER_FILES =
|
||||
|
||||
man_MANS =
|
||||
noinst_DATA =
|
||||
pkglib_DATA =
|
||||
pkgdata_DATA =
|
||||
bin_SCRIPTS =
|
||||
sbin_SCRIPTS =
|
||||
bin_PROGRAMS =
|
||||
@ -147,11 +147,12 @@ check_SCRIPTS =
|
||||
grubconf_DATA =
|
||||
check_PROGRAMS =
|
||||
noinst_SCRIPTS =
|
||||
pkglib_SCRIPTS =
|
||||
noinst_PROGRAMS =
|
||||
grubconf_SCRIPTS =
|
||||
noinst_LIBRARIES =
|
||||
dist_noinst_DATA =
|
||||
platform_SCRIPTS =
|
||||
platform_PROGRAMS =
|
||||
|
||||
TESTS =
|
||||
EXTRA_DIST =
|
||||
|
@ -4,6 +4,7 @@ EXTRA_DIST += geninit.sh
|
||||
EXTRA_DIST += gentpl.py
|
||||
EXTRA_DIST += Makefile.tpl
|
||||
EXTRA_DIST += Makefile.util.def
|
||||
EXTRA_DIST += Makefile.utilgcry.def
|
||||
|
||||
EXTRA_DIST += unicode
|
||||
|
||||
@ -29,6 +30,24 @@ EXTRA_DIST += grub-core/lib/libgcrypt/cipher
|
||||
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 += $(shell find $(top_srcdir)/grub-core/efiemu -name '*.h')
|
||||
EXTRA_DIST += grub-core/efiemu/runtime/config.h
|
||||
|
||||
EXTRA_DIST += grub-core/lib/LzmaDec.c
|
||||
|
||||
EXTRA_DIST += BUGS
|
||||
EXTRA_DIST += util/i386/efi/grub-dumpdevtree
|
||||
|
||||
EXTRA_DIST += m4/gnulib-cache.m4
|
||||
EXTRA_DIST += m4/glibc2.m4
|
||||
EXTRA_DIST += m4/gnulib-tool.m4
|
||||
EXTRA_DIST += m4/intdiv0.m4
|
||||
EXTRA_DIST += m4/intl.m4
|
||||
EXTRA_DIST += m4/intldir.m4
|
||||
EXTRA_DIST += m4/intmax.m4
|
||||
EXTRA_DIST += m4/inttypes-pri.m4
|
||||
EXTRA_DIST += m4/lcmessage.m4
|
||||
EXTRA_DIST += m4/lock.m4
|
||||
EXTRA_DIST += m4/printf-posix.m4
|
||||
EXTRA_DIST += m4/threadlib.m4
|
||||
EXTRA_DIST += m4/uintmax_t.m4
|
||||
EXTRA_DIST += m4/visibility.m4
|
||||
|
@ -18,6 +18,8 @@ SECTIONS
|
||||
__rdata_end__ = . ;
|
||||
*(.pdata)
|
||||
edata = . ;
|
||||
_edata = . ;
|
||||
__edata = . ;
|
||||
}
|
||||
.bss :
|
||||
{
|
||||
|
10
config.h.in
10
config.h.in
@ -2,6 +2,9 @@
|
||||
#undef _FILE_OFFSET_BITS
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#if defined(__PPC__) && !defined(__powerpc__)
|
||||
#define __powerpc__ 1
|
||||
#endif
|
||||
#if defined (GRUB_UTIL) || !defined (GRUB_MACHINE)
|
||||
#include <config-util.h>
|
||||
#define NESTED_FUNC_ATTR
|
||||
@ -36,6 +39,13 @@
|
||||
#define NEED_ENABLE_EXECUTE_STACK @NEED_ENABLE_EXECUTE_STACK@
|
||||
/* Define to 1 if GCC generates calls to __register_frame_info(). */
|
||||
#define NEED_REGISTER_FRAME_INFO @NEED_REGISTER_FRAME_INFO@
|
||||
/* Define to 1 to enable disk cache statistics. */
|
||||
#define DISK_CACHE_STATS @DISK_CACHE_STATS@
|
||||
|
||||
#define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@"
|
||||
#define GRUB_PLATFORM "@GRUB_PLATFORM@"
|
||||
|
||||
#define RE_ENABLE_I18N 1
|
||||
|
||||
#if defined(__i386__)
|
||||
#define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
|
||||
|
375
configure.ac
375
configure.ac
@ -32,7 +32,7 @@ dnl type, so there is no conflict. Variables with the prefix "TARGET_"
|
||||
dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
|
||||
dnl type.
|
||||
|
||||
AC_INIT([GRUB],[1.99],[bug-grub@gnu.org])
|
||||
AC_INIT([GRUB],[2.00],[bug-grub@gnu.org])
|
||||
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
|
||||
@ -72,7 +72,7 @@ case "$target_cpu" in
|
||||
amd64) target_cpu=x86_64 ;;
|
||||
sparc) target_cpu=sparc64 ;;
|
||||
mipsel|mips64el)
|
||||
target_cpu=mips;
|
||||
target_cpu=mipsel;
|
||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1";
|
||||
;;
|
||||
mips|mips64)
|
||||
@ -96,7 +96,9 @@ if test "x$with_platform" = x; then
|
||||
powerpc-*) platform=ieee1275 ;;
|
||||
powerpc64-*) platform=ieee1275 ;;
|
||||
sparc64-*) platform=ieee1275 ;;
|
||||
mips-*) platform=yeeloong ;;
|
||||
mipsel-*) platform=loongson ;;
|
||||
mips-*) platform=arc ;;
|
||||
ia64-*) platform=efi ;;
|
||||
*) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
|
||||
esac
|
||||
else
|
||||
@ -122,8 +124,15 @@ case "$target_cpu"-"$platform" in
|
||||
i386-qemu) ;;
|
||||
powerpc-ieee1275) ;;
|
||||
sparc64-ieee1275) ;;
|
||||
mips-qemu-mips) ;;
|
||||
mips-yeeloong) ;;
|
||||
ia64-efi) ;;
|
||||
mips-qemu_mips) ;;
|
||||
mips-qemu-mips) platform=qemu_mips;;
|
||||
mips-arc) ;;
|
||||
mipsel-qemu_mips) ;;
|
||||
mipsel-qemu-mips) platform=qemu_mips;;
|
||||
mipsel-yeeloong) platform=loongson ;;
|
||||
mipsel-fuloong) platform=loongson ;;
|
||||
mipsel-loongson) ;;
|
||||
*-emu) ;;
|
||||
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
|
||||
esac
|
||||
@ -145,6 +154,8 @@ case "$host_os" in
|
||||
linux*) host_kernel=linux ;;
|
||||
freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
|
||||
netbsd*) host_kernel=netbsd ;;
|
||||
solaris*) host_kernel=illumos ;;
|
||||
darwin*) host_kernel=xnu ;;
|
||||
cygwin) host_kernel=windows ;;
|
||||
esac
|
||||
|
||||
@ -156,16 +167,20 @@ case "$platform" in
|
||||
qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
|
||||
pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
|
||||
emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
|
||||
yeeloong) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||
qemu-mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||
loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||
qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||
arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;;
|
||||
esac
|
||||
case "$target_cpu" in
|
||||
mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
|
||||
mips |mipsel) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
|
||||
sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
|
||||
esac
|
||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
|
||||
if test x${target_cpu} = xmipsel ; then
|
||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
|
||||
else
|
||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,` -DGRUB_TARGET_CPU_`echo ${target_cpu} | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`=1"
|
||||
fi
|
||||
|
||||
HOST_CPPFLAGS="$HOST_CPPFLAGS $machine_CPPFLAGS"
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
|
||||
|
||||
AC_SUBST(host_cpu)
|
||||
@ -176,18 +191,34 @@ AC_SUBST(target_cpu)
|
||||
AC_SUBST(platform)
|
||||
|
||||
# Define default variables
|
||||
case "$host_os" in
|
||||
netbsd* | openbsd*)
|
||||
|
||||
have_with_bootdir=n
|
||||
AC_ARG_WITH([bootdir],
|
||||
AS_HELP_STRING([--with-bootdir=DIR],
|
||||
[set the name of /boot directory [[guessed]]]),
|
||||
[have_with_bootdir=y],
|
||||
[have_with_bootdir=n])
|
||||
if test x$have_with_bootdir = xy; then
|
||||
bootdirname="$with_bootdir"
|
||||
else
|
||||
case "$host_os" in
|
||||
netbsd* | openbsd*)
|
||||
# Because /boot is used for the boot block in NetBSD and OpenBSD,
|
||||
bootdirname='' ;;
|
||||
*) bootdirname='boot' ;;
|
||||
esac
|
||||
bootdirname=`echo "$bootdirname" | sed "$program_transform_name"`
|
||||
bootdirname='' ;;
|
||||
*) bootdirname='boot' ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
AC_SUBST(bootdirname)
|
||||
AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
|
||||
[Default boot directory name]")
|
||||
|
||||
grubdirname=`echo "$PACKAGE" | sed "$program_transform_name"`
|
||||
AC_ARG_WITH([grubdir],
|
||||
AS_HELP_STRING([--with-grubdir=DIR],
|
||||
[set the name of grub directory [[guessed]]]),
|
||||
[grubdirname="$with_grubdir"],
|
||||
[grubdirname="$PACKAGE"])
|
||||
|
||||
AC_SUBST(grubdirname)
|
||||
AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
|
||||
[Default grub directory name])
|
||||
@ -219,8 +250,8 @@ for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
|
||||
done
|
||||
done
|
||||
|
||||
if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xyeeloong ); then
|
||||
AC_MSG_ERROR([qemu and yeeloong ports need unifont])
|
||||
if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips); then
|
||||
AC_MSG_ERROR([qemu and loongson ports need unifont])
|
||||
fi
|
||||
|
||||
AC_SUBST([FONT_SOURCE])
|
||||
@ -271,8 +302,12 @@ AC_CHECK_SIZEOF(long)
|
||||
|
||||
grub_apple_cc
|
||||
if test x$grub_cv_apple_cc = xyes ; then
|
||||
HOST_CPPFLAGS="$HOST_CPPFLAGS -DAPPLE_CC=1"
|
||||
HOST_CFLAGS="$HOST_CFLAGS -fnested-functions"
|
||||
HOST_CPPFLAGS="$HOST_CPPFLAGS -fnested-functions"
|
||||
HOST_LDFLAGS="$HOST_LDFLAGS -Wl,-allow_stack_execute"
|
||||
fi
|
||||
|
||||
if test x$USE_NLS = xno; then
|
||||
HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
|
||||
fi
|
||||
|
||||
if test "x$cross_compiling" = xyes; then
|
||||
@ -283,7 +318,7 @@ fi
|
||||
|
||||
# Check for functions and headers.
|
||||
AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getextmntent)
|
||||
AC_CHECK_HEADERS(libzfs.h libnvpair.h sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h)
|
||||
AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
|
||||
|
||||
AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
|
||||
#include <sys/param.h>
|
||||
@ -358,7 +393,9 @@ LDFLAGS="$TARGET_LDFLAGS"
|
||||
LIBS=""
|
||||
|
||||
# debug flags.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g"
|
||||
WARN_FLAGS="-Wall -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Waddress -Wattributes -Wcast-align -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wempty-body -Wendif-labels -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-noreturn -Wmultichar -Wnonnull -Woverflow -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wpointer-sign"
|
||||
HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS"
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
|
||||
|
||||
# Force no alignment to save space on i386.
|
||||
@ -398,29 +435,28 @@ if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
|
||||
fi
|
||||
|
||||
if test "${target_cpu}-${platform}" = mips-yeeloong; then
|
||||
AC_CACHE_CHECK([whether -march=loongson2f works], [grub_cv_cc_march_loongson2f], [
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -march=loongson2f"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_cc_march_loongson2f=yes],
|
||||
[grub_cv_cc_march_loongson2f=no])
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
])
|
||||
# By default, GCC 4.6 generates .eh_frame sections containing unwind
|
||||
# information in some cases where it previously did not. GRUB doesn't need
|
||||
# these and they just use up vital space. Restore the old compiler
|
||||
# behaviour.
|
||||
AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_cc_fno_asynchronous_unwind_tables=yes],
|
||||
[grub_cv_cc_fno_asynchronous_unwind_tables=no])
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
])
|
||||
|
||||
if test "x$grub_cv_cc_march_loongson2f" = xyes; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -march=loongson2f"
|
||||
else
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -march=mips3"
|
||||
fi
|
||||
if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
|
||||
fi
|
||||
|
||||
grub_apple_target_cc
|
||||
if test x$grub_cv_apple_target_cc = xyes ; then
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DAPPLE_CC=1"
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fnested-functions"
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -fnested-functions"
|
||||
|
||||
CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
|
||||
CFLAGS="$CFLAGS -fnested-functions"
|
||||
TARGET_APPLE_CC=1
|
||||
AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
|
||||
if test "x$OBJCONV" = x ; then
|
||||
@ -434,8 +470,10 @@ if test x$grub_cv_apple_target_cc = xyes ; then
|
||||
TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
|
||||
TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
|
||||
TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
|
||||
TARGET_LDFLAGS_OLDMAGIC=""
|
||||
else
|
||||
TARGET_APPLE_CC=0
|
||||
TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
|
||||
# Use linker script if present, otherwise use builtin -N script.
|
||||
if test -f "${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
|
||||
TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
|
||||
@ -451,6 +489,8 @@ fi
|
||||
TARGET_IMG_CFLAGS=
|
||||
fi
|
||||
|
||||
AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
|
||||
|
||||
# For platforms where ELF is not the default link format.
|
||||
AC_MSG_CHECKING([for command to convert module to ELF format])
|
||||
case "${host_os}" in
|
||||
@ -462,10 +502,47 @@ case "${host_os}" in
|
||||
esac
|
||||
AC_MSG_RESULT([$TARGET_OBJ2ELF])
|
||||
|
||||
|
||||
AC_ARG_ENABLE([efiemu],
|
||||
[AS_HELP_STRING([--enable-efiemu],
|
||||
[build and install the efiemu runtimes (default=guessed)])])
|
||||
if test x"$enable_efiemu" = xno ; then
|
||||
efiemu_excuse="explicitly disabled"
|
||||
fi
|
||||
if test x"$target_cpu" != xi386 ; then
|
||||
efiemu_excuse="only available on i386"
|
||||
fi
|
||||
if test x"$platform" = xefi ; then
|
||||
efiemu_excuse="not available on efi"
|
||||
fi
|
||||
if test x"$efiemu_excuse" = x ; then
|
||||
AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
|
||||
SAVED_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_cc_efiemu=yes],
|
||||
[grub_cv_cc_efiemu=no])
|
||||
CFLAGS="$SAVED_CFLAGS"
|
||||
])
|
||||
if test x$grub_cv_cc_efiemu = xno; then
|
||||
efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
|
||||
fi
|
||||
fi
|
||||
if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
|
||||
AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
|
||||
fi
|
||||
if test x"$efiemu_excuse" = x ; then
|
||||
enable_efiemu=yes
|
||||
else
|
||||
enable_efiemu=no
|
||||
fi
|
||||
AC_SUBST([enable_efiemu])
|
||||
|
||||
if test "x$target_m32" = x1; then
|
||||
# Force 32-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
|
||||
TARGET_MODULE_FORMAT="elf32"
|
||||
fi
|
||||
@ -474,6 +551,7 @@ if test "x$target_m64" = x1; then
|
||||
# Force 64-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m64"
|
||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
|
||||
TARGET_MODULE_FORMAT="elf64"
|
||||
fi
|
||||
@ -522,6 +600,14 @@ if [ x"$pie_possible" = xyes ]; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
|
||||
fi]
|
||||
|
||||
# Position independent executable.
|
||||
grub_CHECK_PIC
|
||||
[# Need that, because some distributions ship compilers that include
|
||||
# `-fPIC' in the default specs.
|
||||
if [ x"$pic_possible" = xyes ]; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
|
||||
fi]
|
||||
|
||||
# Smashing stack protector.
|
||||
grub_CHECK_STACK_PROTECTOR
|
||||
# Need that, because some distributions ship compilers that include
|
||||
@ -541,11 +627,18 @@ AC_ARG_ENABLE([werror],
|
||||
[do not use -Werror when building GRUB])])
|
||||
if test x"$enable_werror" != xno ; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
|
||||
HOST_CFLAGS="$HOST_CFLAGS -Werror"
|
||||
fi
|
||||
|
||||
TARGET_CPP="$TARGET_CC -E"
|
||||
TARGET_CCAS=$TARGET_CC
|
||||
|
||||
GRUB_TARGET_CPU="${target_cpu}"
|
||||
GRUB_PLATFORM="${platform}"
|
||||
|
||||
AC_SUBST(GRUB_TARGET_CPU)
|
||||
AC_SUBST(GRUB_PLATFORM)
|
||||
|
||||
AC_SUBST(OBJCONV)
|
||||
AC_SUBST(TARGET_CPP)
|
||||
AC_SUBST(TARGET_CCAS)
|
||||
@ -590,7 +683,7 @@ CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
|
||||
fi
|
||||
|
||||
# Check for libgcc symbols
|
||||
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
|
||||
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x __ia64_trampoline __udivsi3 __umoddi3 __udivdi3 __divsi3 __modsi3 __umodsi3 __moddi3 __divdi3 __ctzdi2 __ctzsi2)
|
||||
|
||||
if test "x$TARGET_APPLE_CC" = x1 ; then
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib"
|
||||
@ -619,39 +712,6 @@ if test "x$target_cpu" = xi386; then
|
||||
grub_I386_ASM_ADDR32
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([efiemu],
|
||||
[AS_HELP_STRING([--enable-efiemu],
|
||||
[build and install the efiemu runtimes (default=guessed)])])
|
||||
if test x"$enable_efiemu" = xno ; then
|
||||
efiemu_excuse="explicitly disabled"
|
||||
fi
|
||||
if test x"$target_cpu" != xi386 ; then
|
||||
efiemu_excuse="only available on i386"
|
||||
fi
|
||||
if test x"$platform" = xefi ; then
|
||||
efiemu_excuse="not available on efi"
|
||||
fi
|
||||
if test x"$efiemu_excuse" = x ; then
|
||||
AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
|
||||
CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_cc_efiemu=yes],
|
||||
[grub_cv_cc_efiemu=no])
|
||||
])
|
||||
if test x$grub_cv_cc_efiemu = xno; then
|
||||
efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
|
||||
fi
|
||||
fi
|
||||
if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
|
||||
AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
|
||||
fi
|
||||
if test x"$efiemu_excuse" = x ; then
|
||||
enable_efiemu=yes
|
||||
else
|
||||
enable_efiemu=no
|
||||
fi
|
||||
AC_SUBST([enable_efiemu])
|
||||
|
||||
if test "$platform" != emu; then
|
||||
AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
|
||||
SAVED_CPPFLAGS="$CPPFLAGS"
|
||||
@ -703,6 +763,17 @@ AC_ARG_ENABLE([mm-debug],
|
||||
[AC_DEFINE([MM_DEBUG], [1],
|
||||
[Define to 1 if you enable memory manager debugging.])])
|
||||
|
||||
AC_ARG_ENABLE([cache-stats],
|
||||
AS_HELP_STRING([--enable-cache-stats],
|
||||
[enable disk cache statistics collection]))
|
||||
|
||||
if test x$enable_cache_stats = xyes; then
|
||||
DISK_CACHE_STATS=1
|
||||
else
|
||||
DISK_CACHE_STATS=0
|
||||
fi
|
||||
AC_SUBST([DISK_CACHE_STATS])
|
||||
|
||||
AC_ARG_ENABLE([grub-emu-usb],
|
||||
[AS_HELP_STRING([--enable-grub-emu-usb],
|
||||
[build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
|
||||
@ -852,10 +923,69 @@ enable_grub_mkfont=yes
|
||||
else
|
||||
enable_grub_mkfont=no
|
||||
fi
|
||||
if test x"$enable_grub_mkfont" = xno && test "x$platform" = xloongson; then
|
||||
AC_MSG_ERROR([loongson port needs grub-mkfont])
|
||||
fi
|
||||
AC_SUBST([enable_grub_mkfont])
|
||||
AC_SUBST([freetype_cflags])
|
||||
AC_SUBST([freetype_libs])
|
||||
|
||||
DJVU_FONT_SOURCE=
|
||||
|
||||
starfield_excuse=
|
||||
|
||||
if test x$enable_grub_mkfont = xno; then
|
||||
starfield_excuse="No grub-mkfont"
|
||||
fi
|
||||
|
||||
if test x"$starfield_excuse" = x; then
|
||||
for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
|
||||
for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do
|
||||
if test -f "$dir/DejaVuSans.$ext"; then
|
||||
DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if test "x$DJVU_FONT_SOURCE" = x; then
|
||||
starfield_excuse="No DejaVu found"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST([DJVU_FONT_SOURCE])
|
||||
|
||||
AC_ARG_ENABLE([grub-mount],
|
||||
[AS_HELP_STRING([--enable-grub-mount],
|
||||
[build and install the `grub-mount' utility (default=guessed)])])
|
||||
if test x"$enable_grub_mount" = xno ; then
|
||||
grub_mount_excuse="explicitly disabled"
|
||||
fi
|
||||
|
||||
if test x"$grub_mount_excuse" = x ; then
|
||||
AC_CHECK_LIB([fuse], [fuse_main_real], [],
|
||||
[grub_mount_excuse="need FUSE library"])
|
||||
fi
|
||||
|
||||
if test x"$grub_mount_excuse" = x ; then
|
||||
# Check for fuse headers.
|
||||
SAVED_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
|
||||
AC_CHECK_HEADERS([fuse/fuse.h], [],
|
||||
[grub_mount_excuse=["need FUSE headers"]])
|
||||
CPPFLAGS="$SAVED_CPPFLAGS"
|
||||
fi
|
||||
|
||||
if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
|
||||
AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled])
|
||||
fi
|
||||
if test x"$grub_mount_excuse" = x ; then
|
||||
enable_grub_mount=yes
|
||||
else
|
||||
enable_grub_mount=no
|
||||
fi
|
||||
AC_SUBST([enable_grub_mount])
|
||||
|
||||
AC_ARG_ENABLE([device-mapper],
|
||||
[AS_HELP_STRING([--enable-device-mapper],
|
||||
[enable Linux device-mapper support (default=guessed)])])
|
||||
@ -905,23 +1035,49 @@ AC_CHECK_LIB([lzma], [lzma_code],
|
||||
[Define to 1 if you have the LZMA library.])],)
|
||||
AC_SUBST([LIBLZMA])
|
||||
|
||||
AC_CHECK_LIB([zfs], [libzfs_init],
|
||||
[LIBZFS="-lzfs"
|
||||
AC_DEFINE([HAVE_LIBZFS], [1],
|
||||
[Define to 1 if you have the ZFS library.])],)
|
||||
AC_SUBST([LIBZFS])
|
||||
AC_ARG_ENABLE([libzfs],
|
||||
[AS_HELP_STRING([--enable-libzfs],
|
||||
[enable libzfs integration (default=guessed)])])
|
||||
if test x"$enable_libzfs" = xno ; then
|
||||
libzfs_excuse="explicitly disabled"
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB([nvpair], [nvlist_print],
|
||||
[LIBNVPAIR="-lnvpair"
|
||||
AC_DEFINE([HAVE_LIBNVPAIR], [1],
|
||||
[Define to 1 if you have the NVPAIR library.])],)
|
||||
if test x"$libzfs_excuse" = x ; then
|
||||
# Only check for system headers if libzfs support has not been disabled.
|
||||
AC_CHECK_HEADERS(libzfs.h libnvpair.h)
|
||||
fi
|
||||
|
||||
if test x"$libzfs_excuse" = x ; then
|
||||
AC_CHECK_LIB([zfs], [libzfs_init],
|
||||
[],
|
||||
[libzfs_excuse="need zfs library"])
|
||||
fi
|
||||
|
||||
if test x"$libzfs_excuse" = x ; then
|
||||
AC_CHECK_LIB([nvpair], [nvlist_print],
|
||||
[],
|
||||
[libzfs_excuse="need nvpair library"])
|
||||
fi
|
||||
|
||||
if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then
|
||||
AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied])
|
||||
fi
|
||||
|
||||
if test x"$libzfs_excuse" = x ; then
|
||||
# We need both libzfs and libnvpair for a successful build.
|
||||
LIBZFS="-lzfs"
|
||||
AC_DEFINE([HAVE_LIBZFS], [1],
|
||||
[Define to 1 if you have the ZFS library.])
|
||||
LIBNVPAIR="-lnvpair"
|
||||
AC_DEFINE([HAVE_LIBNVPAIR], [1],
|
||||
[Define to 1 if you have the NVPAIR library.])
|
||||
fi
|
||||
|
||||
AC_SUBST([LIBZFS])
|
||||
AC_SUBST([LIBNVPAIR])
|
||||
|
||||
LIBS=""
|
||||
|
||||
pkglibrootdir='$(libdir)'/`echo $PACKAGE | sed "$program_transform_name"`
|
||||
AC_SUBST(pkglibrootdir)
|
||||
|
||||
AC_SUBST([FONT_SOURCE])
|
||||
AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
|
||||
[AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
|
||||
@ -945,50 +1101,63 @@ AC_SUBST(NEED_REGISTER_FRAME_INFO)
|
||||
AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
|
||||
AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
|
||||
AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
|
||||
AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])
|
||||
AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
|
||||
AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
|
||||
AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
|
||||
AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
|
||||
AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
|
||||
AM_CONDITIONAL([COND_mips_yeeloong], [test x$target_cpu = xmips -a x$platform = xyeeloong])
|
||||
AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips])
|
||||
AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
|
||||
AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
|
||||
AM_CONDITIONAL([COND_mips_arc], [test x$target_cpu = xmips -a x$platform = xarc])
|
||||
AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
|
||||
AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
|
||||
AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips])
|
||||
AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
|
||||
AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
|
||||
AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
|
||||
|
||||
AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
|
||||
AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
|
||||
AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
|
||||
AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
|
||||
AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
|
||||
AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
|
||||
AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
|
||||
|
||||
AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
|
||||
AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
|
||||
AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
|
||||
AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
|
||||
AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
|
||||
AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
|
||||
AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
|
||||
AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x])
|
||||
AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1])
|
||||
AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
|
||||
AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
|
||||
|
||||
AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
|
||||
AM_CONDITIONAL([COND_CYGWIN], [test x$host_os = xcygwin])
|
||||
AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
|
||||
|
||||
# Output files.
|
||||
cpudir="${target_cpu}"
|
||||
if test x${cpudir} = xmipsel; then
|
||||
cpudir=mips;
|
||||
fi
|
||||
grub_CHECK_LINK_DIR
|
||||
if test x"$link_dir" = xyes ; then
|
||||
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
|
||||
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
|
||||
if test "$platform" != emu ; then
|
||||
AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
|
||||
AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
|
||||
fi
|
||||
else
|
||||
mkdir -p include/grub 2>/dev/null
|
||||
rm -rf include/grub/cpu
|
||||
cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
|
||||
cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
|
||||
if test "$platform" != emu ; then
|
||||
rm -rf include/grub/machine
|
||||
cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
|
||||
cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -1033,6 +1202,11 @@ echo With memory debugging: Yes
|
||||
else
|
||||
echo With memory debugging: No
|
||||
fi
|
||||
if [ x"$enable_cache_stats" = xyes ]; then
|
||||
echo With disk cache statistics: Yes
|
||||
else
|
||||
echo With disk cache statistics: No
|
||||
fi
|
||||
if [ x"$efiemu_excuse" = x ]; then
|
||||
echo efiemu runtime: Yes
|
||||
else
|
||||
@ -1043,5 +1217,20 @@ echo grub-mkfont: Yes
|
||||
else
|
||||
echo grub-mkfont: No "($grub_mkfont_excuse)"
|
||||
fi
|
||||
if [ x"$grub_mount_excuse" = x ]; then
|
||||
echo grub-mount: Yes
|
||||
else
|
||||
echo grub-mount: No "($grub_mount_excuse)"
|
||||
fi
|
||||
if [ x"$starfield_excuse" = x ]; then
|
||||
echo starfield theme: Yes
|
||||
else
|
||||
echo starfield theme: No "($starfield_excuse)"
|
||||
fi
|
||||
if [ x"$libzfs_excuse" = x ]; then
|
||||
echo With libzfs support: Yes
|
||||
else
|
||||
echo With libzfs support: No "($libzfs_excuse)"
|
||||
fi
|
||||
echo "*******************************************************"
|
||||
]
|
||||
|
5
debian/changelog
vendored
5
debian/changelog
vendored
@ -1,4 +1,4 @@
|
||||
grub2 (1.99-23) UNRELEASED; urgency=low
|
||||
grub2 (2.00-1) UNRELEASED; urgency=low
|
||||
|
||||
[ Debconf translations ]
|
||||
* Lithuanian (Rimas Kudelis). Closes: #675628
|
||||
@ -8,6 +8,9 @@ grub2 (1.99-23) UNRELEASED; urgency=low
|
||||
* Romanian (Andrei POPESCU). Closes: #685477
|
||||
* Finnish (Timo Jyrinki).
|
||||
|
||||
[ Jordi Mallach, Colin Watson ]
|
||||
* New upstream release.
|
||||
|
||||
-- Christian Perrier <bubulle@debian.org> Sat, 02 Jun 2012 19:51:35 +0200
|
||||
|
||||
grub2 (1.99-22.1) unstable; urgency=low
|
||||
|
1029
debian/patches/4k_sectors.patch
vendored
1029
debian/patches/4k_sectors.patch
vendored
File diff suppressed because it is too large
Load Diff
45
debian/patches/bash-completion_identifiers.patch
vendored
45
debian/patches/bash-completion_identifiers.patch
vendored
@ -1,45 +0,0 @@
|
||||
Description: Fix incorrect identifiers in bash-completion
|
||||
Author: Andreas Born <futur.andy@googlemail.com>
|
||||
Origin: upstream, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3426
|
||||
Last-Update: 2012-03-05
|
||||
|
||||
Index: b/util/bash-completion.d/grub-completion.bash.in
|
||||
===================================================================
|
||||
--- a/util/bash-completion.d/grub-completion.bash.in
|
||||
+++ b/util/bash-completion.d/grub-completion.bash.in
|
||||
@@ -402,7 +402,7 @@
|
||||
#
|
||||
# grub-mkpasswd-pbkdf2
|
||||
#
|
||||
-_grub_mkpasswd-pbkdf2 () {
|
||||
+_grub_mkpasswd_pbkdf2 () {
|
||||
local cur
|
||||
|
||||
COMPREPLY=()
|
||||
@@ -417,7 +417,7 @@
|
||||
}
|
||||
__grub_mkpasswd_pbkdf2_program=$( echo grub-mkpasswd-pbkdf2 | sed "@program_transform_name@" )
|
||||
have ${__grub_mkpasswd_pbkdf2_program} && \
|
||||
- complete -F _grub_mkpasswd-pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program}
|
||||
+ complete -F _grub_mkpasswd_pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program}
|
||||
unset __grub_mkpasswd_pbkdf2_program
|
||||
|
||||
|
||||
@@ -462,7 +462,7 @@
|
||||
#
|
||||
# grub-script-check
|
||||
#
|
||||
-_grub_script-check () {
|
||||
+_grub_script_check () {
|
||||
local cur
|
||||
|
||||
COMPREPLY=()
|
||||
@@ -477,7 +477,7 @@
|
||||
}
|
||||
__grub_script_check_program=$( echo grub-script-check | sed "@program_transform_name@" )
|
||||
have ${__grub_script_check_program} && \
|
||||
- complete -F _grub_script-check -o filenames ${__grub_script_check_program}
|
||||
+ complete -F _grub_script_check -o filenames ${__grub_script_check_program}
|
||||
|
||||
|
||||
# Local variables:
|
286
debian/patches/branch_devmapper.patch
vendored
286
debian/patches/branch_devmapper.patch
vendored
@ -1,286 +0,0 @@
|
||||
Description: Support for partitioned loop devices; improved devmapper support
|
||||
Author: Vladimir Serbinenko <phcoder@gmail.com>
|
||||
Origin: upstream, http://bzr.sv.gnu.org/r/grub/branches/devmapper/
|
||||
Forwarded: not-needed
|
||||
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3302
|
||||
Last-Update: 2011-05-19
|
||||
|
||||
Index: b/grub-core/kern/emu/getroot.c
|
||||
===================================================================
|
||||
--- a/grub-core/kern/emu/getroot.c
|
||||
+++ b/grub-core/kern/emu/getroot.c
|
||||
@@ -34,6 +34,10 @@
|
||||
#include <stdint.h>
|
||||
#include <grub/util/misc.h>
|
||||
|
||||
+#ifdef HAVE_DEVICE_MAPPER
|
||||
+# include <libdevmapper.h>
|
||||
+#endif
|
||||
+
|
||||
#ifdef __GNU__
|
||||
#include <hurd.h>
|
||||
#include <hurd/lookup.h>
|
||||
@@ -634,32 +638,65 @@
|
||||
}
|
||||
|
||||
static int
|
||||
-grub_util_is_dmraid (const char *os_dev)
|
||||
+grub_util_is_lvm (const char *os_dev)
|
||||
{
|
||||
- if (! strncmp (os_dev, "/dev/mapper/nvidia_", 19))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/isw_", 16))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/hpt37x_", 19))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/hpt45x_", 19))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/via_", 16))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/lsi_", 16))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/pdc_", 16))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/jmicron_", 20))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/asr_", 16))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/sil_", 16))
|
||||
- return 1;
|
||||
- else if (! strncmp (os_dev, "/dev/mapper/ddf1_", 17))
|
||||
- return 1;
|
||||
+ if ((strncmp ("/dev/mapper/", os_dev, 12) != 0))
|
||||
+ return 0;
|
||||
+
|
||||
+#ifdef HAVE_DEVICE_MAPPER
|
||||
+ {
|
||||
+ struct dm_tree *tree;
|
||||
+ uint32_t maj, min;
|
||||
+ struct dm_tree_node *node = NULL;
|
||||
+ const char *node_uuid;
|
||||
+ struct stat st;
|
||||
|
||||
- return 0;
|
||||
+ if (stat (os_dev, &st) < 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ tree = dm_tree_create ();
|
||||
+ if (! tree)
|
||||
+ {
|
||||
+ grub_printf ("Failed to create tree\n");
|
||||
+ grub_dprintf ("hostdisk", "dm_tree_create failed\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ maj = major (st.st_rdev);
|
||||
+ min = minor (st.st_rdev);
|
||||
+
|
||||
+ if (! dm_tree_add_dev (tree, maj, min))
|
||||
+ {
|
||||
+ grub_dprintf ("hostdisk", "dm_tree_add_dev failed\n");
|
||||
+ dm_tree_free (tree);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ node = dm_tree_find_node (tree, maj, min);
|
||||
+ if (! node)
|
||||
+ {
|
||||
+ grub_dprintf ("hostdisk", "dm_tree_find_node failed\n");
|
||||
+ dm_tree_free (tree);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ node_uuid = dm_tree_node_get_uuid (node);
|
||||
+ if (! node_uuid)
|
||||
+ {
|
||||
+ grub_dprintf ("hostdisk", "%s has no DM uuid\n", os_dev);
|
||||
+ dm_tree_free (tree);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (strncmp (node_uuid, "LVM-", 4) != 0)
|
||||
+ {
|
||||
+ dm_tree_free (tree);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ dm_tree_free (tree);
|
||||
+ return 1;
|
||||
+ }
|
||||
+#else
|
||||
+ return 1;
|
||||
+#endif /* HAVE_DEVICE_MAPPER */
|
||||
}
|
||||
|
||||
int
|
||||
@@ -671,13 +708,11 @@
|
||||
return GRUB_DEV_ABSTRACTION_NONE;
|
||||
|
||||
/* Check for LVM. */
|
||||
- if (!strncmp (os_dev, "/dev/mapper/", 12)
|
||||
- && ! grub_util_is_dmraid (os_dev)
|
||||
- && strncmp (os_dev, "/dev/mapper/mpath", 17) != 0)
|
||||
+ if (grub_util_is_lvm (os_dev))
|
||||
return GRUB_DEV_ABSTRACTION_LVM;
|
||||
|
||||
/* Check for RAID. */
|
||||
- if (!strncmp (os_dev, "/dev/md", 7))
|
||||
+ if (!strncmp (os_dev, "/dev/md", 7) && ! grub_util_device_is_mapped (os_dev))
|
||||
return GRUB_DEV_ABSTRACTION_RAID;
|
||||
#endif
|
||||
|
||||
Index: b/grub-core/kern/emu/hostdisk.c
|
||||
===================================================================
|
||||
--- a/grub-core/kern/emu/hostdisk.c
|
||||
+++ b/grub-core/kern/emu/hostdisk.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <grub/err.h>
|
||||
#include <grub/emu/misc.h>
|
||||
#include <grub/emu/hostdisk.h>
|
||||
+#include <grub/emu/getroot.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/list.h>
|
||||
@@ -331,18 +332,23 @@
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
-#ifdef HAVE_DEVICE_MAPPER
|
||||
-static int
|
||||
-device_is_mapped (const char *dev)
|
||||
+int
|
||||
+grub_util_device_is_mapped (const char *dev)
|
||||
{
|
||||
+#ifdef HAVE_DEVICE_MAPPER
|
||||
struct stat st;
|
||||
|
||||
+ if (!grub_device_mapper_supported ())
|
||||
+ return 0;
|
||||
+
|
||||
if (stat (dev, &st) < 0)
|
||||
return 0;
|
||||
|
||||
return dm_is_dm_major (major (st.st_rdev));
|
||||
-}
|
||||
+#else
|
||||
+ return 0;
|
||||
#endif /* HAVE_DEVICE_MAPPER */
|
||||
+}
|
||||
|
||||
#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
/* FIXME: geom actually gives us the whole container hierarchy.
|
||||
@@ -418,7 +424,7 @@
|
||||
# endif /* !defined(HAVE_DIOCGDINFO) */
|
||||
|
||||
# ifdef HAVE_DEVICE_MAPPER
|
||||
- if (grub_device_mapper_supported () && device_is_mapped (dev)) {
|
||||
+ if (grub_util_device_is_mapped (dev)) {
|
||||
struct dm_task *task = NULL;
|
||||
grub_uint64_t start, length;
|
||||
char *target_type, *params, *space;
|
||||
@@ -1161,6 +1167,54 @@
|
||||
return ret;
|
||||
}
|
||||
|
||||
+#ifdef HAVE_DEVICE_MAPPER
|
||||
+static int
|
||||
+grub_util_get_dm_node_linear_info (const char *dev,
|
||||
+ int *maj, int *min)
|
||||
+{
|
||||
+ struct dm_task *dmt;
|
||||
+ void *next = NULL;
|
||||
+ uint64_t length, start;
|
||||
+ char *target, *params;
|
||||
+ char *ptr;
|
||||
+ int major, minor;
|
||||
+
|
||||
+ dmt = dm_task_create(DM_DEVICE_TABLE);
|
||||
+ if (!dmt)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (!dm_task_set_name(dmt, dev))
|
||||
+ return 0;
|
||||
+ dm_task_no_open_count(dmt);
|
||||
+ if (!dm_task_run(dmt))
|
||||
+ return 0;
|
||||
+ next = dm_get_next_target(dmt, next, &start, &length,
|
||||
+ &target, ¶ms);
|
||||
+ if (grub_strcmp (target, "linear") != 0)
|
||||
+ return 0;
|
||||
+ major = grub_strtoul (params, &ptr, 10);
|
||||
+ if (grub_errno)
|
||||
+ {
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (*ptr != ':')
|
||||
+ return 0;
|
||||
+ ptr++;
|
||||
+ minor = grub_strtoul (ptr, 0, 10);
|
||||
+ if (grub_errno)
|
||||
+ {
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (maj)
|
||||
+ *maj = major;
|
||||
+ if (min)
|
||||
+ *min = minor;
|
||||
+ return 1;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static char *
|
||||
convert_system_partition_to_system_disk (const char *os_dev, struct stat *st)
|
||||
{
|
||||
@@ -1337,9 +1391,39 @@
|
||||
node = NULL;
|
||||
goto devmapper_out;
|
||||
}
|
||||
- else if (strncmp (node_uuid, "DMRAID-", 7) != 0)
|
||||
+ if (strncmp (node_uuid, "LVM-", 4) == 0)
|
||||
{
|
||||
+ grub_dprintf ("hostdisk", "%s is an LVM\n", path);
|
||||
+ node = NULL;
|
||||
+ goto devmapper_out;
|
||||
+ }
|
||||
+ if (strncmp (node_uuid, "mpath-", 6) == 0)
|
||||
+ {
|
||||
+ /* Multipath partitions have partN-mpath-* UUIDs, and are
|
||||
+ linear mappings so are handled by
|
||||
+ grub_util_get_dm_node_linear_info. Multipath disks are not
|
||||
+ linear mappings and must be handled specially. */
|
||||
+ grub_dprintf ("hostdisk", "%s is a multipath disk\n", path);
|
||||
+ mapper_name = dm_tree_node_get_name (node);
|
||||
+ goto devmapper_out;
|
||||
+ }
|
||||
+ if (strncmp (node_uuid, "DMRAID-", 7) != 0)
|
||||
+ {
|
||||
+ int major, minor;
|
||||
+ const char *node_name;
|
||||
grub_dprintf ("hostdisk", "%s is not DM-RAID\n", path);
|
||||
+
|
||||
+ if ((node_name = dm_tree_node_get_name (node))
|
||||
+ && grub_util_get_dm_node_linear_info (node_name,
|
||||
+ &major, &minor))
|
||||
+ {
|
||||
+ if (tree)
|
||||
+ dm_tree_free (tree);
|
||||
+ free (path);
|
||||
+ char *ret = grub_find_device (NULL, (major << 8) | minor);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
node = NULL;
|
||||
goto devmapper_out;
|
||||
}
|
||||
Index: b/include/grub/emu/misc.h
|
||||
===================================================================
|
||||
--- a/include/grub/emu/misc.h
|
||||
+++ b/include/grub/emu/misc.h
|
||||
@@ -54,6 +54,8 @@
|
||||
|
||||
char *grub_make_system_path_relative_to_its_root (const char *path)
|
||||
__attribute__ ((warn_unused_result));
|
||||
+int
|
||||
+grub_util_device_is_mapped (const char *dev);
|
||||
|
||||
void * EXPORT_FUNC(xmalloc) (grub_size_t size) __attribute__ ((warn_unused_result));
|
||||
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) __attribute__ ((warn_unused_result));
|
247
debian/patches/branch_embed-sectors.patch
vendored
247
debian/patches/branch_embed-sectors.patch
vendored
@ -1,247 +0,0 @@
|
||||
Description: Detect other software using embedding area
|
||||
When embedding the core image in a post-MBR gap, check for and avoid
|
||||
sectors matching any of the signatures in embed_signatures.
|
||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||
Origin: upstream, http://bzr.sv.gnu.org/r/grub/branches/embed-sectors/
|
||||
Forwarded: http://lists.gnu.org/archive/html/grub-devel/2010-08/msg00137.html
|
||||
Last-Update: 2011-04-21
|
||||
|
||||
Index: b/ChangeLog.embed-sectors
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/ChangeLog.embed-sectors
|
||||
@@ -0,0 +1,12 @@
|
||||
+2011-03-14 Colin Watson <cjwatson@ubuntu.com>
|
||||
+
|
||||
+ * include/grub/partition.h (grub_partition_map): Change prototype of
|
||||
+ embed to take a maximum value for nsectors.
|
||||
+ * grub-core/partmap/msdos.c (embed_signatures): New array.
|
||||
+ (pc_partition_map_embed): Check for and avoid sectors matching any
|
||||
+ of the signatures in embed_signatures, up to max_nsectors.
|
||||
+ * grub-core/partmap/gpt.c (gpt_partition_map_embed): Restrict
|
||||
+ returned sector map to max_nsectors.
|
||||
+ * util/grub-setup.c (setup): Allow for the embedding area being
|
||||
+ split into multiple blocklists. Tell dest_partmap->embed the
|
||||
+ maximum number of sectors we care about.
|
||||
Index: b/grub-core/partmap/gpt.c
|
||||
===================================================================
|
||||
--- a/grub-core/partmap/gpt.c
|
||||
+++ b/grub-core/partmap/gpt.c
|
||||
@@ -127,6 +127,7 @@
|
||||
#ifdef GRUB_UTIL
|
||||
static grub_err_t
|
||||
gpt_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
|
||||
+ unsigned int max_nsectors,
|
||||
grub_embed_type_t embed_type,
|
||||
grub_disk_addr_t **sectors)
|
||||
{
|
||||
@@ -176,6 +177,8 @@
|
||||
" embedding won't be possible!");
|
||||
|
||||
*nsectors = len;
|
||||
+ if (*nsectors > max_nsectors)
|
||||
+ *nsectors = max_nsectors;
|
||||
*sectors = grub_malloc (*nsectors * sizeof (**sectors));
|
||||
if (!*sectors)
|
||||
return grub_errno;
|
||||
Index: b/grub-core/partmap/msdos.c
|
||||
===================================================================
|
||||
--- a/grub-core/partmap/msdos.c
|
||||
+++ b/grub-core/partmap/msdos.c
|
||||
@@ -29,6 +29,66 @@
|
||||
static struct grub_partition_map grub_msdos_partition_map;
|
||||
|
||||
|
||||
+#ifdef GRUB_UTIL
|
||||
+#include <grub/emu/misc.h>
|
||||
+
|
||||
+struct embed_signature
|
||||
+{
|
||||
+ const char *name;
|
||||
+ const char *signature;
|
||||
+ int signature_len;
|
||||
+ enum { TYPE_SOFTWARE, TYPE_RAID } type;
|
||||
+};
|
||||
+
|
||||
+const char message_warn[][200] = {
|
||||
+ [TYPE_RAID] = "Sector %llu is already in use by %s; avoiding it. "
|
||||
+ "Please ask the manufacturer not to store data in MBR gap",
|
||||
+ [TYPE_SOFTWARE] = "Sector %llu is already in use by %s; avoiding it. "
|
||||
+ "This software may cause boot or other problems in "
|
||||
+ "future. Please ask its authors not to store data "
|
||||
+ "in the boot track"
|
||||
+};
|
||||
+
|
||||
+
|
||||
+/* Signatures of other software that may be using sectors in the embedding
|
||||
+ area. */
|
||||
+struct embed_signature embed_signatures[] =
|
||||
+ {
|
||||
+ {
|
||||
+ .name = "ZISD",
|
||||
+ .signature = "ZISD",
|
||||
+ .signature_len = 4,
|
||||
+ .type = TYPE_SOFTWARE
|
||||
+ },
|
||||
+ {
|
||||
+ .name = "FlexNet",
|
||||
+ .signature = "\xd4\x41\xa0\xf5\x03\x00\x03\x00",
|
||||
+ .signature_len = 8,
|
||||
+ .type = TYPE_SOFTWARE
|
||||
+ },
|
||||
+ {
|
||||
+ .name = "FlexNet",
|
||||
+ .signature = "\xd8\x41\xa0\xf5\x02\x00\x02\x00",
|
||||
+ .signature_len = 8,
|
||||
+ .type = TYPE_SOFTWARE
|
||||
+ },
|
||||
+ {
|
||||
+ /* from Ryan Perkins */
|
||||
+ .name = "HP Backup and Recovery Manager (?)",
|
||||
+ .signature = "\x70\x8a\x5d\x46\x35\xc5\x1b\x93"
|
||||
+ "\xae\x3d\x86\xfd\xb1\x55\x3e\xe0",
|
||||
+ .signature_len = 16,
|
||||
+ .type = TYPE_SOFTWARE
|
||||
+ },
|
||||
+ {
|
||||
+ .name = "HighPoint RAID controller",
|
||||
+ .signature = "ycgl",
|
||||
+ .signature_len = 4,
|
||||
+ .type = TYPE_RAID
|
||||
+ }
|
||||
+ };
|
||||
+#endif
|
||||
+
|
||||
grub_err_t
|
||||
grub_partition_msdos_iterate (grub_disk_t disk,
|
||||
int (*hook) (grub_disk_t disk,
|
||||
@@ -148,6 +208,7 @@
|
||||
#ifdef GRUB_UTIL
|
||||
static grub_err_t
|
||||
pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
|
||||
+ unsigned int max_nsectors,
|
||||
grub_embed_type_t embed_type,
|
||||
grub_disk_addr_t **sectors)
|
||||
{
|
||||
@@ -236,13 +297,65 @@
|
||||
|
||||
if (end >= *nsectors + 2)
|
||||
{
|
||||
- unsigned i;
|
||||
+ unsigned i, j;
|
||||
+ char *embed_signature_check;
|
||||
+ unsigned int orig_nsectors, avail_nsectors;
|
||||
+
|
||||
+ orig_nsectors = *nsectors;
|
||||
*nsectors = end - 2;
|
||||
+ avail_nsectors = *nsectors;
|
||||
+ if (*nsectors > max_nsectors)
|
||||
+ *nsectors = max_nsectors;
|
||||
*sectors = grub_malloc (*nsectors * sizeof (**sectors));
|
||||
if (!*sectors)
|
||||
return grub_errno;
|
||||
for (i = 0; i < *nsectors; i++)
|
||||
(*sectors)[i] = 1 + i;
|
||||
+
|
||||
+ /* Check for software that is already using parts of the embedding
|
||||
+ * area.
|
||||
+ */
|
||||
+ embed_signature_check = grub_malloc (GRUB_DISK_SECTOR_SIZE);
|
||||
+ for (i = 0; i < *nsectors; i++)
|
||||
+ {
|
||||
+ if (grub_disk_read (disk, (*sectors)[i], 0, GRUB_DISK_SECTOR_SIZE,
|
||||
+ embed_signature_check))
|
||||
+ continue;
|
||||
+
|
||||
+ for (j = 0; j < ARRAY_SIZE (embed_signatures); j++)
|
||||
+ if (! grub_memcmp (embed_signatures[j].signature,
|
||||
+ embed_signature_check,
|
||||
+ embed_signatures[j].signature_len))
|
||||
+ break;
|
||||
+ if (j == ARRAY_SIZE (embed_signatures))
|
||||
+ continue;
|
||||
+ grub_util_warn (message_warn[embed_signatures[j].type],
|
||||
+ (*sectors)[i], embed_signatures[j].name);
|
||||
+ avail_nsectors--;
|
||||
+ if (avail_nsectors < *nsectors)
|
||||
+ *nsectors = avail_nsectors;
|
||||
+
|
||||
+ /* Avoid this sector. */
|
||||
+ for (j = i; j < *nsectors; j++)
|
||||
+ (*sectors)[j]++;
|
||||
+
|
||||
+ /* Have we run out of space? */
|
||||
+ if (avail_nsectors < orig_nsectors)
|
||||
+ break;
|
||||
+
|
||||
+ /* Make sure to check the next sector. */
|
||||
+ i--;
|
||||
+ }
|
||||
+ grub_free (embed_signature_check);
|
||||
+
|
||||
+ if (*nsectors < orig_nsectors)
|
||||
+ return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
+ "Other software is using the embedding area, and "
|
||||
+ "there is not enough room for core.img. Such "
|
||||
+ "software is often trying to store data in a way "
|
||||
+ "that avoids detection. We recommend you "
|
||||
+ "investigate.");
|
||||
+
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
Index: b/include/grub/partition.h
|
||||
===================================================================
|
||||
--- a/include/grub/partition.h
|
||||
+++ b/include/grub/partition.h
|
||||
@@ -49,6 +49,7 @@
|
||||
#ifdef GRUB_UTIL
|
||||
/* Determine sectors available for embedding. */
|
||||
grub_err_t (*embed) (struct grub_disk *disk, unsigned int *nsectors,
|
||||
+ unsigned int max_nsectors,
|
||||
grub_embed_type_t embed_type,
|
||||
grub_disk_addr_t **sectors);
|
||||
#endif
|
||||
Index: b/util/grub-setup.c
|
||||
===================================================================
|
||||
--- a/util/grub-setup.c
|
||||
+++ b/util/grub-setup.c
|
||||
@@ -428,10 +428,8 @@
|
||||
}
|
||||
|
||||
nsec = core_sectors;
|
||||
- err = dest_partmap->embed (dest_dev->disk, &nsec,
|
||||
+ err = dest_partmap->embed (dest_dev->disk, &nsec, 2 * core_sectors,
|
||||
GRUB_EMBED_PCBIOS, §ors);
|
||||
- if (nsec > 2 * core_sectors)
|
||||
- nsec = 2 * core_sectors;
|
||||
|
||||
if (err)
|
||||
{
|
||||
@@ -460,6 +458,13 @@
|
||||
save_blocklists (sectors[i] + grub_partition_get_start (container),
|
||||
0, GRUB_DISK_SECTOR_SIZE);
|
||||
|
||||
+ /* Make sure that the last blocklist is a terminator. */
|
||||
+ if (block == first_block)
|
||||
+ block--;
|
||||
+ block->start = 0;
|
||||
+ block->len = 0;
|
||||
+ block->segment = 0;
|
||||
+
|
||||
write_rootdev (core_img, root_dev, boot_img, first_sector);
|
||||
|
||||
core_img = realloc (core_img, nsec * GRUB_DISK_SECTOR_SIZE);
|
||||
@@ -476,12 +481,6 @@
|
||||
nsec * GRUB_DISK_SECTOR_SIZE
|
||||
- core_size);
|
||||
|
||||
- /* Make sure that the second blocklist is a terminator. */
|
||||
- block = first_block - 1;
|
||||
- block->start = 0;
|
||||
- block->len = 0;
|
||||
- block->segment = 0;
|
||||
-
|
||||
/* Write the core image onto the disk. */
|
||||
for (i = 0; i < nsec; i++)
|
||||
grub_disk_write (dest_dev->disk, sectors[i], 0,
|
605
debian/patches/branch_fuse.patch
vendored
605
debian/patches/branch_fuse.patch
vendored
@ -1,605 +0,0 @@
|
||||
Description: Add grub-mount utility
|
||||
Author: Vladimir Serbinenko <phcoder@gmail.com>
|
||||
Origin: upstream, http://bzr.sv.gnu.org/r/grub/branches/fuse/
|
||||
Forwarded: http://lists.gnu.org/archive/html/grub-devel/2011-01/msg00056.html
|
||||
Last-Update: 2011-07-10
|
||||
|
||||
--- a/Makefile.util.def
|
||||
+++ b/Makefile.util.def
|
||||
@@ -216,6 +216,21 @@
|
||||
};
|
||||
|
||||
program = {
|
||||
+ name = grub-mount;
|
||||
+ mansection = 1;
|
||||
+ common_nodist = grub_fstest_init.c;
|
||||
+ common = util/grub-mount.c;
|
||||
+ common = grub-core/kern/emu/hostfs.c;
|
||||
+ common = grub-core/disk/host.c;
|
||||
+
|
||||
+ ldadd = libgrubmods.a;
|
||||
+ ldadd = libgrubkern.a;
|
||||
+ ldadd = grub-core/gnulib/libgnu.a;
|
||||
+ ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) -lfuse';
|
||||
+ condition = COND_GRUB_MOUNT;
|
||||
+};
|
||||
+
|
||||
+program = {
|
||||
name = grub-mkfont;
|
||||
mansection = 1;
|
||||
common = util/grub-mkfont.c;
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -856,6 +856,37 @@
|
||||
AC_SUBST([freetype_cflags])
|
||||
AC_SUBST([freetype_libs])
|
||||
|
||||
+AC_ARG_ENABLE([grub-mount],
|
||||
+ [AS_HELP_STRING([--enable-grub-mount],
|
||||
+ [build and install the `grub-mount' utility (default=guessed)])])
|
||||
+if test x"$enable_grub_mount" = xno ; then
|
||||
+ grub_mount_excuse="explicitly disabled"
|
||||
+fi
|
||||
+
|
||||
+if test x"$grub_mount_excuse" = x ; then
|
||||
+ AC_CHECK_LIB([fuse], [fuse_main_real], [],
|
||||
+ [grub_mount_excuse="need FUSE library"])
|
||||
+fi
|
||||
+
|
||||
+if test x"$grub_mount_excuse" = x ; then
|
||||
+ # Check for fuse headers.
|
||||
+ SAVED_CPPFLAGS="$CPPFLAGS"
|
||||
+ CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
|
||||
+ AC_CHECK_HEADERS([fuse/fuse.h], [],
|
||||
+ [grub_mount_excuse=["need FUSE headers"]])
|
||||
+ CPPFLAGS="$SAVED_CPPFLAGS"
|
||||
+fi
|
||||
+
|
||||
+if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
|
||||
+ AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled])
|
||||
+fi
|
||||
+if test x"$grub_mount_excuse" = x ; then
|
||||
+enable_grub_mount=yes
|
||||
+else
|
||||
+enable_grub_mount=no
|
||||
+fi
|
||||
+AC_SUBST([enable_grub_mount])
|
||||
+
|
||||
AC_ARG_ENABLE([device-mapper],
|
||||
[AS_HELP_STRING([--enable-device-mapper],
|
||||
[enable Linux device-mapper support (default=guessed)])])
|
||||
@@ -967,6 +998,7 @@
|
||||
AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
|
||||
AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
|
||||
AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
|
||||
+AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
|
||||
AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
|
||||
AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x])
|
||||
AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1])
|
||||
@@ -1043,5 +1075,10 @@
|
||||
else
|
||||
echo grub-mkfont: No "($grub_mkfont_excuse)"
|
||||
fi
|
||||
+if [ x"$grub_mount_excuse" = x ]; then
|
||||
+echo grub-mount: Yes
|
||||
+else
|
||||
+echo grub-mount: No "($grub_mount_excuse)"
|
||||
+fi
|
||||
echo "*******************************************************"
|
||||
]
|
||||
--- /dev/null
|
||||
+++ b/docs/man/grub-mount.h2m
|
||||
@@ -0,0 +1,2 @@
|
||||
+[NAME]
|
||||
+grub-mount \- export GRUB filesystem with FUSE
|
||||
--- /dev/null
|
||||
+++ b/util/grub-mount.c
|
||||
@@ -0,0 +1,508 @@
|
||||
+/* grub-mount.c - FUSE driver for filesystems that GRUB understands */
|
||||
+/*
|
||||
+ * GRUB -- GRand Unified Bootloader
|
||||
+ * Copyright (C) 2008,2009,2010 Free Software Foundation, Inc.
|
||||
+ *
|
||||
+ * GRUB is free software: you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, either version 3 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * GRUB is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+#define FUSE_USE_VERSION 26
|
||||
+#include <config.h>
|
||||
+#include <grub/types.h>
|
||||
+#include <grub/emu/misc.h>
|
||||
+#include <grub/util/misc.h>
|
||||
+#include <grub/misc.h>
|
||||
+#include <grub/device.h>
|
||||
+#include <grub/disk.h>
|
||||
+#include <grub/file.h>
|
||||
+#include <grub/fs.h>
|
||||
+#include <grub/env.h>
|
||||
+#include <grub/term.h>
|
||||
+#include <grub/mm.h>
|
||||
+#include <grub/lib/hexdump.h>
|
||||
+#include <grub/crypto.h>
|
||||
+#include <grub/command.h>
|
||||
+#include <grub/i18n.h>
|
||||
+#include <fuse/fuse.h>
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <unistd.h>
|
||||
+#include <string.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+#include "progname.h"
|
||||
+#include "argp.h"
|
||||
+
|
||||
+static char *root = NULL;
|
||||
+grub_device_t dev = NULL;
|
||||
+grub_fs_t fs = NULL;
|
||||
+static char **images = NULL;
|
||||
+static char *debug_str = NULL;
|
||||
+static char **fuse_args = NULL;
|
||||
+static int fuse_argc = 0;
|
||||
+static int num_disks = 0;
|
||||
+
|
||||
+static grub_err_t
|
||||
+execute_command (char *name, int n, char **args)
|
||||
+{
|
||||
+ grub_command_t cmd;
|
||||
+
|
||||
+ cmd = grub_command_find (name);
|
||||
+ if (! cmd)
|
||||
+ grub_util_error (_("can\'t find command %s"), name);
|
||||
+
|
||||
+ return (cmd->func) (cmd, n, args);
|
||||
+}
|
||||
+
|
||||
+/* Translate GRUB error numbers into OS error numbers. Print any unexpected
|
||||
+ errors. */
|
||||
+static int
|
||||
+translate_error (void)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ switch (grub_errno)
|
||||
+ {
|
||||
+ case GRUB_ERR_NONE:
|
||||
+ ret = 0;
|
||||
+ break;
|
||||
+
|
||||
+ case GRUB_ERR_OUT_OF_MEMORY:
|
||||
+ grub_print_error ();
|
||||
+ ret = -ENOMEM;
|
||||
+ break;
|
||||
+
|
||||
+ case GRUB_ERR_BAD_FILE_TYPE:
|
||||
+ /* This could also be EISDIR. Take a guess. */
|
||||
+ ret = -ENOTDIR;
|
||||
+ break;
|
||||
+
|
||||
+ case GRUB_ERR_FILE_NOT_FOUND:
|
||||
+ ret = -ENOENT;
|
||||
+ break;
|
||||
+
|
||||
+ case GRUB_ERR_FILE_READ_ERROR:
|
||||
+ case GRUB_ERR_READ_ERROR:
|
||||
+ case GRUB_ERR_IO:
|
||||
+ grub_print_error ();
|
||||
+ ret = -EIO;
|
||||
+ break;
|
||||
+
|
||||
+ case GRUB_ERR_SYMLINK_LOOP:
|
||||
+ ret = -ELOOP;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ grub_print_error ();
|
||||
+ ret = -EINVAL;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ /* Any previous errors were handled. */
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+fuse_getattr (const char *path, struct stat *st)
|
||||
+{
|
||||
+ char *filename, *pathname, *path2;
|
||||
+ const char *pathname_t;
|
||||
+ struct grub_dirhook_info file_info;
|
||||
+ int file_exists = 0;
|
||||
+
|
||||
+ /* A hook for iterating directories. */
|
||||
+ auto int find_file (const char *cur_filename,
|
||||
+ const struct grub_dirhook_info *info);
|
||||
+ int find_file (const char *cur_filename,
|
||||
+ const struct grub_dirhook_info *info)
|
||||
+ {
|
||||
+ if ((info->case_insensitive ? grub_strcasecmp (cur_filename, filename)
|
||||
+ : grub_strcmp (cur_filename, filename)) == 0)
|
||||
+ {
|
||||
+ file_info = *info;
|
||||
+ file_exists = 1;
|
||||
+ return 1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (path[0] == '/' && path[1] == 0)
|
||||
+ {
|
||||
+ st->st_dev = 0;
|
||||
+ st->st_ino = 0;
|
||||
+ st->st_mode = 0555 | S_IFDIR;
|
||||
+ st->st_uid = 0;
|
||||
+ st->st_gid = 0;
|
||||
+ st->st_rdev = 0;
|
||||
+ st->st_size = 0;
|
||||
+ st->st_blksize = 512;
|
||||
+ st->st_blocks = (st->st_blksize + 511) >> 9;
|
||||
+ st->st_atime = st->st_mtime = st->st_ctime = 0;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ file_exists = 0;
|
||||
+
|
||||
+ pathname_t = grub_strchr (path, ')');
|
||||
+ if (! pathname_t)
|
||||
+ pathname_t = path;
|
||||
+ else
|
||||
+ pathname_t++;
|
||||
+ pathname = xstrdup (pathname_t);
|
||||
+
|
||||
+ /* Remove trailing '/'. */
|
||||
+ while (*pathname && pathname[grub_strlen (pathname) - 1] == '/')
|
||||
+ pathname[grub_strlen (pathname) - 1] = 0;
|
||||
+
|
||||
+ /* Split into path and filename. */
|
||||
+ filename = grub_strrchr (pathname, '/');
|
||||
+ if (! filename)
|
||||
+ {
|
||||
+ path2 = grub_strdup ("/");
|
||||
+ filename = pathname;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ filename++;
|
||||
+ path2 = grub_strdup (pathname);
|
||||
+ path2[filename - pathname] = 0;
|
||||
+ }
|
||||
+
|
||||
+ /* It's the whole device. */
|
||||
+ (fs->dir) (dev, path2, find_file);
|
||||
+
|
||||
+ grub_free (path2);
|
||||
+ if (!file_exists)
|
||||
+ {
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ return -ENOENT;
|
||||
+ }
|
||||
+ st->st_dev = 0;
|
||||
+ st->st_ino = 0;
|
||||
+ st->st_mode = file_info.dir ? (0555 | S_IFDIR) : (0444 | S_IFREG);
|
||||
+ st->st_uid = 0;
|
||||
+ st->st_gid = 0;
|
||||
+ st->st_rdev = 0;
|
||||
+ if (!file_info.dir)
|
||||
+ {
|
||||
+ grub_file_t file;
|
||||
+ file = grub_file_open (path);
|
||||
+ if (! file)
|
||||
+ return translate_error ();
|
||||
+ st->st_size = file->size;
|
||||
+ grub_file_close (file);
|
||||
+ }
|
||||
+ else
|
||||
+ st->st_size = 0;
|
||||
+ st->st_blksize = 512;
|
||||
+ st->st_blocks = (st->st_size + 511) >> 9;
|
||||
+ st->st_atime = st->st_mtime = st->st_ctime = file_info.mtimeset
|
||||
+ ? file_info.mtime : 0;
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+fuse_opendir (const char *path, struct fuse_file_info *fi)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/* FIXME */
|
||||
+static grub_file_t files[65536];
|
||||
+static int first_fd = 1;
|
||||
+
|
||||
+static int
|
||||
+fuse_open (const char *path, struct fuse_file_info *fi __attribute__ ((unused)))
|
||||
+{
|
||||
+ grub_file_t file;
|
||||
+ file = grub_file_open (path);
|
||||
+ if (! file)
|
||||
+ return translate_error ();
|
||||
+ files[first_fd++] = file;
|
||||
+ fi->fh = first_fd;
|
||||
+ files[first_fd++] = file;
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+fuse_read (const char *path, char *buf, size_t sz, off_t off,
|
||||
+ struct fuse_file_info *fi)
|
||||
+{
|
||||
+ grub_file_t file = files[fi->fh];
|
||||
+ grub_ssize_t size;
|
||||
+
|
||||
+ if (off > file->size)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ file->offset = off;
|
||||
+
|
||||
+ size = grub_file_read (file, buf, sz);
|
||||
+ if (size < 0)
|
||||
+ return translate_error ();
|
||||
+ else
|
||||
+ {
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ return size;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+fuse_release (const char *path, struct fuse_file_info *fi)
|
||||
+{
|
||||
+ grub_file_close (files[fi->fh]);
|
||||
+ files[fi->fh] = NULL;
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+fuse_readdir (const char *path, void *buf,
|
||||
+ fuse_fill_dir_t fill, off_t off, struct fuse_file_info *fi)
|
||||
+{
|
||||
+ char *pathname;
|
||||
+
|
||||
+ auto int call_fill (const char *filename,
|
||||
+ const struct grub_dirhook_info *info);
|
||||
+ int call_fill (const char *filename, const struct grub_dirhook_info *info)
|
||||
+ {
|
||||
+ fill (buf, filename, NULL, 0);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ pathname = xstrdup (path);
|
||||
+
|
||||
+ /* Remove trailing '/'. */
|
||||
+ while (pathname [0] && pathname[1]
|
||||
+ && pathname[grub_strlen (pathname) - 1] == '/')
|
||||
+ pathname[grub_strlen (pathname) - 1] = 0;
|
||||
+
|
||||
+ (fs->dir) (dev, pathname, call_fill);
|
||||
+ free (pathname);
|
||||
+ grub_errno = GRUB_ERR_NONE;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+struct fuse_operations grub_opers = {
|
||||
+ .getattr = fuse_getattr,
|
||||
+ .open = fuse_open,
|
||||
+ .release = fuse_release,
|
||||
+ .opendir = fuse_opendir,
|
||||
+ .readdir = fuse_readdir,
|
||||
+ .read = fuse_read
|
||||
+};
|
||||
+
|
||||
+static grub_err_t
|
||||
+fuse_init (void)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < num_disks; i++)
|
||||
+ {
|
||||
+ char *argv[2];
|
||||
+ char *host_file;
|
||||
+ char *loop_name;
|
||||
+ loop_name = grub_xasprintf ("loop%d", i);
|
||||
+ if (!loop_name)
|
||||
+ grub_util_error (grub_errmsg);
|
||||
+
|
||||
+ host_file = grub_xasprintf ("(host)%s", images[i]);
|
||||
+ if (!host_file)
|
||||
+ grub_util_error (grub_errmsg);
|
||||
+
|
||||
+ argv[0] = loop_name;
|
||||
+ argv[1] = host_file;
|
||||
+
|
||||
+ if (execute_command ("loopback", 2, argv))
|
||||
+ grub_util_error (_("loopback command fails"));
|
||||
+
|
||||
+ grub_free (loop_name);
|
||||
+ grub_free (host_file);
|
||||
+ }
|
||||
+
|
||||
+ grub_lvm_fini ();
|
||||
+ grub_mdraid09_fini ();
|
||||
+ grub_mdraid1x_fini ();
|
||||
+ grub_raid_fini ();
|
||||
+ grub_raid_init ();
|
||||
+ grub_mdraid09_init ();
|
||||
+ grub_mdraid1x_init ();
|
||||
+ grub_lvm_init ();
|
||||
+
|
||||
+ dev = grub_device_open (0);
|
||||
+ if (! dev)
|
||||
+ return grub_errno;
|
||||
+
|
||||
+ fs = grub_fs_probe (dev);
|
||||
+ if (! fs)
|
||||
+ {
|
||||
+ grub_device_close (dev);
|
||||
+ return grub_errno;
|
||||
+ }
|
||||
+
|
||||
+ fuse_main (fuse_argc, fuse_args, &grub_opers, NULL);
|
||||
+
|
||||
+ for (i = 0; i < num_disks; i++)
|
||||
+ {
|
||||
+ char *argv[2];
|
||||
+ char *loop_name;
|
||||
+
|
||||
+ loop_name = grub_xasprintf ("loop%d", i);
|
||||
+ if (!loop_name)
|
||||
+ grub_util_error (grub_errmsg);
|
||||
+
|
||||
+ argv[0] = "-d";
|
||||
+ argv[1] = loop_name;
|
||||
+
|
||||
+ execute_command ("loopback", 2, argv);
|
||||
+
|
||||
+ grub_free (loop_name);
|
||||
+ }
|
||||
+
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static struct argp_option options[] = {
|
||||
+ {"root", 'r', N_("DEVICE_NAME"), 0, N_("Set root device."), 2},
|
||||
+ {"debug", 'd', "S", 0, N_("Set debug environment variable."), 2},
|
||||
+ {"verbose", 'v', NULL, OPTION_ARG_OPTIONAL, N_("Print verbose messages."), 2},
|
||||
+ {0, 0, 0, 0, 0, 0}
|
||||
+};
|
||||
+
|
||||
+/* Print the version information. */
|
||||
+static void
|
||||
+print_version (FILE *stream, struct argp_state *state)
|
||||
+{
|
||||
+ fprintf (stream, "%s (%s) %s\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
+}
|
||||
+void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
|
||||
+
|
||||
+error_t
|
||||
+argp_parser (int key, char *arg, struct argp_state *state)
|
||||
+{
|
||||
+ char *p;
|
||||
+
|
||||
+ switch (key)
|
||||
+ {
|
||||
+ case 'r':
|
||||
+ root = arg;
|
||||
+ return 0;
|
||||
+
|
||||
+ case 'd':
|
||||
+ debug_str = arg;
|
||||
+ return 0;
|
||||
+
|
||||
+ case 'v':
|
||||
+ verbosity++;
|
||||
+ return 0;
|
||||
+
|
||||
+ case ARGP_KEY_ARG:
|
||||
+ if (arg[0] != '-')
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ if (!arg)
|
||||
+ return 0;
|
||||
+
|
||||
+ fuse_args = xrealloc (fuse_args, (fuse_argc + 1) * sizeof (fuse_args[0]));
|
||||
+ fuse_args[fuse_argc] = xstrdup (arg);
|
||||
+ fuse_argc++;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (arg[0] != '/')
|
||||
+ {
|
||||
+ fprintf (stderr, "%s", _("Must use absolute path.\n"));
|
||||
+ argp_usage (state);
|
||||
+ }
|
||||
+ images = xrealloc (images, (num_disks + 1) * sizeof (images[0]));
|
||||
+ images[num_disks] = xstrdup (arg);
|
||||
+ num_disks++;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+struct argp argp = {
|
||||
+ options, argp_parser, N_("IMAGE1 [IMAGE2 ...] MOUNTPOINT"),
|
||||
+ N_("Debug tool for filesystem driver."),
|
||||
+ NULL, NULL, NULL
|
||||
+};
|
||||
+
|
||||
+int
|
||||
+main (int argc, char *argv[])
|
||||
+{
|
||||
+ char *default_root, *alloc_root;
|
||||
+
|
||||
+ set_program_name (argv[0]);
|
||||
+
|
||||
+ grub_util_init_nls ();
|
||||
+
|
||||
+ fuse_args = xrealloc (fuse_args, (fuse_argc + 2) * sizeof (fuse_args[0]));
|
||||
+ fuse_args[fuse_argc] = xstrdup (argv[0]);
|
||||
+ fuse_argc++;
|
||||
+ /* Run single-threaded. */
|
||||
+ fuse_args[fuse_argc] = xstrdup ("-s");
|
||||
+ fuse_argc++;
|
||||
+
|
||||
+ argp_parse (&argp, argc, argv, 0, 0, 0);
|
||||
+
|
||||
+ if (num_disks < 2)
|
||||
+ grub_util_error ("need an image and mountpoint");
|
||||
+ fuse_args = xrealloc (fuse_args, (fuse_argc + 2) * sizeof (fuse_args[0]));
|
||||
+ fuse_args[fuse_argc] = images[num_disks - 1];
|
||||
+ fuse_argc++;
|
||||
+ num_disks--;
|
||||
+ fuse_args[fuse_argc] = NULL;
|
||||
+
|
||||
+ /* Initialize all modules. */
|
||||
+ grub_init_all ();
|
||||
+
|
||||
+ if (debug_str)
|
||||
+ grub_env_set ("debug", debug_str);
|
||||
+
|
||||
+ default_root = (num_disks == 1) ? "loop0" : "md0";
|
||||
+ alloc_root = 0;
|
||||
+ if (root)
|
||||
+ {
|
||||
+ if ((*root >= '0') && (*root <= '9'))
|
||||
+ {
|
||||
+ alloc_root = xmalloc (strlen (default_root) + strlen (root) + 2);
|
||||
+
|
||||
+ sprintf (alloc_root, "%s,%s", default_root, root);
|
||||
+ root = alloc_root;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ root = default_root;
|
||||
+
|
||||
+ grub_env_set ("root", root);
|
||||
+
|
||||
+ if (alloc_root)
|
||||
+ free (alloc_root);
|
||||
+
|
||||
+ /* Do it. */
|
||||
+ fuse_init ();
|
||||
+ if (grub_errno)
|
||||
+ {
|
||||
+ grub_print_error ();
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ /* Free resources. */
|
||||
+ grub_fini_all ();
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
179
debian/patches/branch_longlinuxcmd.patch
vendored
179
debian/patches/branch_longlinuxcmd.patch
vendored
@ -1,179 +0,0 @@
|
||||
Description: Support long Linux command lines
|
||||
Author: Vladimir Serbinenko <phcoder@gmail.com>
|
||||
Origin: upstream, http://bzr.sv.gnu.org/r/grub/branches/longlinuxcmd/
|
||||
Forwarded: not-needed
|
||||
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3303
|
||||
Last-Update: 2011-05-19
|
||||
|
||||
Index: b/grub-core/loader/i386/linux.c
|
||||
===================================================================
|
||||
--- a/grub-core/loader/i386/linux.c
|
||||
+++ b/grub-core/loader/i386/linux.c
|
||||
@@ -57,7 +57,6 @@
|
||||
#endif
|
||||
|
||||
#define GRUB_LINUX_CL_OFFSET 0x1000
|
||||
-#define GRUB_LINUX_CL_END_OFFSET 0x2000
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
@@ -74,6 +73,7 @@
|
||||
static grub_uint32_t initrd_pages;
|
||||
static struct grub_relocator *relocator = NULL;
|
||||
static void *efi_mmap_buf;
|
||||
+static grub_size_t maximal_cmdline_size;
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
static grub_efi_uintn_t efi_mmap_size;
|
||||
#else
|
||||
@@ -189,7 +189,7 @@
|
||||
grub_err_t err;
|
||||
|
||||
/* Make sure that each size is aligned to a page boundary. */
|
||||
- real_size = GRUB_LINUX_CL_END_OFFSET;
|
||||
+ real_size = GRUB_LINUX_CL_OFFSET + maximal_cmdline_size;
|
||||
prot_size = page_align (prot_size);
|
||||
mmap_size = find_mmap_size ();
|
||||
|
||||
@@ -662,6 +662,14 @@
|
||||
goto fail;
|
||||
}
|
||||
|
||||
+ if (grub_le_to_cpu16 (lh.version) >= 0x0206)
|
||||
+ maximal_cmdline_size = grub_le_to_cpu32 (lh.cmdline_size) + 1;
|
||||
+ else
|
||||
+ maximal_cmdline_size = 256;
|
||||
+
|
||||
+ if (maximal_cmdline_size < 128)
|
||||
+ maximal_cmdline_size = 128;
|
||||
+
|
||||
setup_sects = lh.setup_sects;
|
||||
|
||||
/* If SETUP_SECTS is not set, set it to the default (4). */
|
||||
@@ -675,7 +683,7 @@
|
||||
goto fail;
|
||||
|
||||
params = (struct linux_kernel_params *) real_mode_mem;
|
||||
- grub_memset (params, 0, GRUB_LINUX_CL_END_OFFSET);
|
||||
+ grub_memset (params, 0, GRUB_LINUX_CL_OFFSET + maximal_cmdline_size);
|
||||
grub_memcpy (¶ms->setup_sects, &lh.setup_sects, sizeof (lh) - 0x1F1);
|
||||
|
||||
params->ps_mouse = params->padding10 = 0;
|
||||
@@ -870,7 +878,7 @@
|
||||
grub_create_loader_cmdline (argc, argv,
|
||||
(char *)real_mode_mem + GRUB_LINUX_CL_OFFSET
|
||||
+ sizeof (LINUX_IMAGE) - 1,
|
||||
- GRUB_LINUX_CL_END_OFFSET - GRUB_LINUX_CL_OFFSET
|
||||
+ maximal_cmdline_size
|
||||
- (sizeof (LINUX_IMAGE) - 1));
|
||||
|
||||
len = prot_size;
|
||||
Index: b/grub-core/loader/i386/pc/linux.c
|
||||
===================================================================
|
||||
--- a/grub-core/loader/i386/pc/linux.c
|
||||
+++ b/grub-core/loader/i386/pc/linux.c
|
||||
@@ -39,7 +39,6 @@
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define GRUB_LINUX_CL_OFFSET 0x9000
|
||||
-#define GRUB_LINUX_CL_END_OFFSET 0x90FF
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
@@ -49,6 +48,7 @@
|
||||
static grub_addr_t grub_linux_real_target;
|
||||
static char *grub_linux_real_chunk;
|
||||
static grub_size_t grub_linux16_prot_size;
|
||||
+static grub_size_t maximal_cmdline_size;
|
||||
|
||||
static grub_err_t
|
||||
grub_linux16_boot (void)
|
||||
@@ -128,15 +128,20 @@
|
||||
setup_sects = lh.setup_sects;
|
||||
linux_mem_size = 0;
|
||||
|
||||
+ maximal_cmdline_size = 256;
|
||||
+
|
||||
if (lh.header == grub_cpu_to_le32 (GRUB_LINUX_MAGIC_SIGNATURE)
|
||||
&& grub_le_to_cpu16 (lh.version) >= 0x0200)
|
||||
{
|
||||
grub_linux_is_bzimage = (lh.loadflags & GRUB_LINUX_FLAG_BIG_KERNEL);
|
||||
lh.type_of_loader = GRUB_LINUX_BOOT_LOADER_TYPE;
|
||||
|
||||
+ if (grub_le_to_cpu16 (lh.version) >= 0x0206)
|
||||
+ maximal_cmdline_size = grub_le_to_cpu32 (lh.cmdline_size) + 1;
|
||||
+
|
||||
/* Put the real mode part at as a high location as possible. */
|
||||
grub_linux_real_target = grub_mmap_get_lower ()
|
||||
- - GRUB_LINUX_SETUP_MOVE_SIZE;
|
||||
+ - (GRUB_LINUX_CL_OFFSET + maximal_cmdline_size);
|
||||
/* But it must not exceed the traditional area. */
|
||||
if (grub_linux_real_target > GRUB_LINUX_OLD_REAL_MODE_ADDR)
|
||||
grub_linux_real_target = GRUB_LINUX_OLD_REAL_MODE_ADDR;
|
||||
@@ -153,7 +158,8 @@
|
||||
{
|
||||
lh.cl_magic = grub_cpu_to_le16 (GRUB_LINUX_CL_MAGIC);
|
||||
lh.cl_offset = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET);
|
||||
- lh.setup_move_size = grub_cpu_to_le16 (GRUB_LINUX_SETUP_MOVE_SIZE);
|
||||
+ lh.setup_move_size = grub_cpu_to_le16 (GRUB_LINUX_CL_OFFSET
|
||||
+ + maximal_cmdline_size);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -185,12 +191,13 @@
|
||||
goto fail;
|
||||
}
|
||||
|
||||
- if (grub_linux_real_target + GRUB_LINUX_SETUP_MOVE_SIZE
|
||||
+ if (grub_linux_real_target + GRUB_LINUX_CL_OFFSET + maximal_cmdline_size
|
||||
> grub_mmap_get_lower ())
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"too small lower memory (0x%x > 0x%x)",
|
||||
- grub_linux_real_target + GRUB_LINUX_SETUP_MOVE_SIZE,
|
||||
+ grub_linux_real_target + GRUB_LINUX_CL_OFFSET
|
||||
+ + maximal_cmdline_size,
|
||||
(int) grub_mmap_get_lower ());
|
||||
goto fail;
|
||||
}
|
||||
@@ -263,7 +270,8 @@
|
||||
grub_relocator_chunk_t ch;
|
||||
err = grub_relocator_alloc_chunk_addr (relocator, &ch,
|
||||
grub_linux_real_target,
|
||||
- GRUB_LINUX_SETUP_MOVE_SIZE);
|
||||
+ GRUB_LINUX_CL_OFFSET
|
||||
+ + maximal_cmdline_size);
|
||||
if (err)
|
||||
return err;
|
||||
grub_linux_real_chunk = get_virtual_current_address (ch);
|
||||
@@ -294,7 +302,7 @@
|
||||
grub_create_loader_cmdline (argc, argv,
|
||||
(char *)grub_linux_real_chunk
|
||||
+ GRUB_LINUX_CL_OFFSET + sizeof (LINUX_IMAGE) - 1,
|
||||
- GRUB_LINUX_CL_END_OFFSET - GRUB_LINUX_CL_OFFSET
|
||||
+ maximal_cmdline_size
|
||||
- (sizeof (LINUX_IMAGE) - 1));
|
||||
|
||||
if (grub_linux_is_bzimage)
|
||||
Index: b/include/grub/i386/linux.h
|
||||
===================================================================
|
||||
--- a/include/grub/i386/linux.h
|
||||
+++ b/include/grub/i386/linux.h
|
||||
@@ -41,7 +41,6 @@
|
||||
#define GRUB_LINUX_VID_MODE_ASK 0xFFFD
|
||||
#define GRUB_LINUX_VID_MODE_VESA_START 0x0300
|
||||
|
||||
-#define GRUB_LINUX_SETUP_MOVE_SIZE 0x9100
|
||||
#define GRUB_LINUX_CL_MAGIC 0xA33F
|
||||
|
||||
#ifdef __x86_64__
|
||||
@@ -130,6 +129,10 @@
|
||||
grub_uint16_t pad1; /* Unused */
|
||||
grub_uint32_t cmd_line_ptr; /* Points to the kernel command line */
|
||||
grub_uint32_t initrd_addr_max; /* Highest address for initrd */
|
||||
+ grub_uint32_t kernel_alignment;
|
||||
+ grub_uint8_t relocatable;
|
||||
+ grub_uint8_t pad[3];
|
||||
+ grub_uint32_t cmdline_size;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* Boot parameters for Linux based on 2.6.12. This is used by the setup
|
1310
debian/patches/branch_parse-color.patch
vendored
1310
debian/patches/branch_parse-color.patch
vendored
File diff suppressed because it is too large
Load Diff
694
debian/patches/branch_squash.patch
vendored
694
debian/patches/branch_squash.patch
vendored
@ -1,694 +0,0 @@
|
||||
Description: Add squashfs 4 support
|
||||
Author: Vladimir Serbinenko <phcoder@gmail.com>
|
||||
Origin: upstream, http://bzr.sv.gnu.org/r/grub/branches/squash/
|
||||
Forwarded: not-needed
|
||||
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3278
|
||||
Last-Update: 2011-05-19
|
||||
|
||||
Index: b/Makefile.util.def
|
||||
===================================================================
|
||||
--- a/Makefile.util.def
|
||||
+++ b/Makefile.util.def
|
||||
@@ -65,6 +65,7 @@
|
||||
common = grub-core/fs/ntfscomp.c;
|
||||
common = grub-core/fs/reiserfs.c;
|
||||
common = grub-core/fs/sfs.c;
|
||||
+ common = grub-core/fs/squash4.c;
|
||||
common = grub-core/fs/tar.c;
|
||||
common = grub-core/fs/udf.c;
|
||||
common = grub-core/fs/ufs2.c;
|
||||
Index: b/grub-core/Makefile.core.def
|
||||
===================================================================
|
||||
--- a/grub-core/Makefile.core.def
|
||||
+++ b/grub-core/Makefile.core.def
|
||||
@@ -985,6 +985,11 @@
|
||||
};
|
||||
|
||||
module = {
|
||||
+ name = squash4;
|
||||
+ common = fs/squash4.c;
|
||||
+};
|
||||
+
|
||||
+module = {
|
||||
name = tar;
|
||||
common = fs/tar.c;
|
||||
};
|
||||
Index: b/grub-core/fs/squash4.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/grub-core/fs/squash4.c
|
||||
@@ -0,0 +1,548 @@
|
||||
+/* squash4.c - SquashFS */
|
||||
+/*
|
||||
+ * GRUB -- GRand Unified Bootloader
|
||||
+ * Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
+ *
|
||||
+ * GRUB is free software: you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, either version 3 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * GRUB is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#include <grub/err.h>
|
||||
+#include <grub/file.h>
|
||||
+#include <grub/mm.h>
|
||||
+#include <grub/misc.h>
|
||||
+#include <grub/disk.h>
|
||||
+#include <grub/dl.h>
|
||||
+#include <grub/types.h>
|
||||
+#include <grub/fshelp.h>
|
||||
+#include <grub/deflate.h>
|
||||
+
|
||||
+GRUB_MOD_LICENSE ("GPLv3+");
|
||||
+
|
||||
+/*
|
||||
+ object format Pointed by
|
||||
+ superblock RAW Fixed offset (0)
|
||||
+ data RAW ? Fixed offset (60)
|
||||
+ inode table Chunk superblock
|
||||
+ dir table Chunk superblock
|
||||
+ fragment table Chunk unk1
|
||||
+ unk1 RAW, Chunk superblock
|
||||
+ unk2 RAW superblock
|
||||
+ UID/GID Chunk exttblptr
|
||||
+ exttblptr RAW superblock
|
||||
+
|
||||
+ UID/GID table is the array ot uint32_t
|
||||
+ unk1 contains pointer to unk3 followed by some chunk.
|
||||
+ unk2 containts one uint64_t
|
||||
+*/
|
||||
+
|
||||
+struct grub_squash_super
|
||||
+{
|
||||
+ grub_uint32_t magic;
|
||||
+#define SQUASH_MAGIC 0x73717368
|
||||
+ grub_uint32_t dummy1;
|
||||
+ grub_uint32_t creation_time;
|
||||
+ grub_uint32_t dummy2;
|
||||
+ grub_uint64_t dummy3;
|
||||
+ grub_uint8_t flags;
|
||||
+#define SQUASH_FLAG_UNCOMPRESSED_INODES 1
|
||||
+#define SQUASH_FLAG_UNCOMPRESSED_DATA 2
|
||||
+#define SQUASH_FLAG_UNCOMPRESSED_FRAGMENTS 8
|
||||
+ grub_uint8_t dummy4[7];
|
||||
+ grub_uint16_t root_ino_offset;
|
||||
+ grub_uint32_t root_ino_chunk;
|
||||
+ grub_uint16_t dummy5;
|
||||
+ grub_uint64_t total_size;
|
||||
+ grub_uint64_t exttbloffset;
|
||||
+ grub_uint64_t dummy6;
|
||||
+ grub_uint64_t inodeoffset;
|
||||
+ grub_uint64_t diroffset;
|
||||
+ grub_uint64_t unk1offset;
|
||||
+ grub_uint64_t unk2offset;
|
||||
+} __attribute__ ((packed));
|
||||
+
|
||||
+
|
||||
+/* Chunk-based */
|
||||
+struct grub_squash_inode
|
||||
+{
|
||||
+ /* Same values as direlem types. */
|
||||
+ grub_uint16_t type;
|
||||
+ grub_uint16_t dummy[3];
|
||||
+ grub_uint32_t mtime;
|
||||
+ union
|
||||
+ {
|
||||
+ struct {
|
||||
+ grub_uint32_t dummy;
|
||||
+ grub_uint32_t chunk;
|
||||
+ grub_uint32_t fragment;
|
||||
+ grub_uint32_t offset;
|
||||
+ grub_uint32_t size;
|
||||
+ } __attribute__ ((packed)) file;
|
||||
+ struct {
|
||||
+ grub_uint32_t dummy1;
|
||||
+ grub_uint32_t chunk;
|
||||
+ grub_uint32_t dummy2;
|
||||
+ grub_uint16_t size;
|
||||
+ grub_uint32_t offset;
|
||||
+ grub_uint16_t dummy3;
|
||||
+ } __attribute__ ((packed)) dir;
|
||||
+ struct {
|
||||
+ grub_uint64_t dummy;
|
||||
+ grub_uint32_t namelen;
|
||||
+ char name[0];
|
||||
+ } __attribute__ ((packed)) symlink;
|
||||
+ } __attribute__ ((packed));
|
||||
+} __attribute__ ((packed));
|
||||
+
|
||||
+/* Chunk-based. */
|
||||
+struct grub_squash_dirent_header
|
||||
+{
|
||||
+ /* Actually the value is the number of elements - 1. */
|
||||
+ grub_uint32_t nelems;
|
||||
+ grub_uint64_t ino_chunk;
|
||||
+} __attribute__ ((packed));
|
||||
+
|
||||
+struct grub_squash_dirent
|
||||
+{
|
||||
+ grub_uint16_t ino_offset;
|
||||
+ grub_uint16_t dummy;
|
||||
+ grub_uint16_t type;
|
||||
+#define SQUASH_TYPE_DIR 1
|
||||
+#define SQUASH_TYPE_REGULAR 2
|
||||
+#define SQUASH_TYPE_SYMLINK 3
|
||||
+ /* Actually the value is the length of name - 1. */
|
||||
+ grub_uint16_t namelen;
|
||||
+ char name[0];
|
||||
+} __attribute__ ((packed));
|
||||
+
|
||||
+struct grub_squash_frag_desc
|
||||
+{
|
||||
+ grub_uint64_t offset;
|
||||
+ grub_uint64_t dummy;
|
||||
+} __attribute__ ((packed));
|
||||
+
|
||||
+#define SQUASH_CHUNK_SIZE 0x2000
|
||||
+#define SQUASH_CHUNK_FLAGS 0x8000
|
||||
+#define SQUASH_CHUNK_UNCOMPRESSED 0x8000
|
||||
+
|
||||
+struct grub_squash_data
|
||||
+{
|
||||
+ grub_disk_t disk;
|
||||
+ struct grub_squash_super sb;
|
||||
+ struct grub_squash_inode ino;
|
||||
+ grub_uint64_t fragments;
|
||||
+};
|
||||
+
|
||||
+struct grub_fshelp_node
|
||||
+{
|
||||
+ struct grub_squash_data *data;
|
||||
+ struct grub_squash_inode ino;
|
||||
+ grub_uint32_t ino_chunk;
|
||||
+ grub_uint16_t ino_offset;
|
||||
+};
|
||||
+
|
||||
+static grub_err_t
|
||||
+read_chunk (grub_disk_t disk, void *buf, grub_size_t len,
|
||||
+ grub_uint64_t chunk, grub_off_t offset)
|
||||
+{
|
||||
+ grub_uint64_t chunk_start;
|
||||
+ chunk_start = grub_le_to_cpu64 (chunk);
|
||||
+ while (len > 0)
|
||||
+ {
|
||||
+ grub_uint64_t csize;
|
||||
+ grub_uint16_t d;
|
||||
+ grub_err_t err;
|
||||
+ while (1)
|
||||
+ {
|
||||
+ err = grub_disk_read (disk, chunk_start >> GRUB_DISK_SECTOR_BITS,
|
||||
+ chunk_start & (GRUB_DISK_SECTOR_SIZE - 1),
|
||||
+ sizeof (d), &d);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+ if (offset < SQUASH_CHUNK_SIZE)
|
||||
+ break;
|
||||
+ offset -= SQUASH_CHUNK_SIZE;
|
||||
+ chunk_start += 2 + (grub_le_to_cpu16 (d) & ~SQUASH_CHUNK_FLAGS);
|
||||
+ }
|
||||
+
|
||||
+ csize = SQUASH_CHUNK_SIZE - offset;
|
||||
+ if (csize > len)
|
||||
+ csize = len;
|
||||
+
|
||||
+ if (grub_le_to_cpu16 (d) & SQUASH_CHUNK_UNCOMPRESSED)
|
||||
+ {
|
||||
+ grub_disk_addr_t a = chunk_start + 2 + offset;
|
||||
+ err = grub_disk_read (disk, (a >> GRUB_DISK_SECTOR_BITS),
|
||||
+ a & (GRUB_DISK_SECTOR_SIZE - 1),
|
||||
+ csize, buf);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ char *tmp;
|
||||
+ grub_size_t bsize = grub_le_to_cpu16 (d) & ~SQUASH_CHUNK_FLAGS;
|
||||
+ grub_disk_addr_t a = chunk_start + 2;
|
||||
+ tmp = grub_malloc (bsize);
|
||||
+ if (!tmp)
|
||||
+ return grub_errno;
|
||||
+ /* FIXME: buffer uncompressed data. */
|
||||
+ err = grub_disk_read (disk, (a >> GRUB_DISK_SECTOR_BITS),
|
||||
+ a & (GRUB_DISK_SECTOR_SIZE - 1),
|
||||
+ bsize, tmp);
|
||||
+ if (err)
|
||||
+ {
|
||||
+ grub_free (tmp);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ if (grub_zlib_decompress (tmp, bsize, offset,
|
||||
+ buf, csize) < 0)
|
||||
+ {
|
||||
+ grub_free (tmp);
|
||||
+ return grub_errno;
|
||||
+ }
|
||||
+ grub_free (tmp);
|
||||
+ }
|
||||
+ len -= csize;
|
||||
+ offset += csize;
|
||||
+ buf = (char *) buf + csize;
|
||||
+ }
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static struct grub_squash_data *
|
||||
+squash_mount (grub_disk_t disk)
|
||||
+{
|
||||
+ struct grub_squash_super sb;
|
||||
+ grub_err_t err;
|
||||
+ struct grub_squash_data *data;
|
||||
+ grub_uint64_t frag;
|
||||
+
|
||||
+ err = grub_disk_read (disk, 0, 0, sizeof (sb), &sb);
|
||||
+ if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
|
||||
+ grub_error (GRUB_ERR_BAD_FS, "not a squash4");
|
||||
+ if (err)
|
||||
+ return NULL;
|
||||
+ if (grub_le_to_cpu32 (sb.magic) != SQUASH_MAGIC)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_BAD_FS, "not squash4");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ err = grub_disk_read (disk, grub_le_to_cpu32 (sb.unk1offset)
|
||||
+ >> GRUB_DISK_SECTOR_BITS,
|
||||
+ grub_le_to_cpu32 (sb.unk1offset)
|
||||
+ & (GRUB_DISK_SECTOR_SIZE - 1), sizeof (frag), &frag);
|
||||
+ if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
|
||||
+ grub_error (GRUB_ERR_BAD_FS, "not a squash4");
|
||||
+ if (err)
|
||||
+ return NULL;
|
||||
+
|
||||
+ data = grub_malloc (sizeof (*data));
|
||||
+ if (!data)
|
||||
+ return NULL;
|
||||
+ data->sb = sb;
|
||||
+ data->disk = disk;
|
||||
+ data->fragments = frag;
|
||||
+
|
||||
+ return data;
|
||||
+}
|
||||
+
|
||||
+static char *
|
||||
+grub_squash_read_symlink (grub_fshelp_node_t node)
|
||||
+{
|
||||
+ char *ret;
|
||||
+ grub_err_t err;
|
||||
+ ret = grub_malloc (grub_le_to_cpu32 (node->ino.symlink.namelen) + 1);
|
||||
+
|
||||
+ err = read_chunk (node->data->disk, ret,
|
||||
+ grub_le_to_cpu32 (node->ino.symlink.namelen),
|
||||
+ grub_le_to_cpu64 (node->data->sb.inodeoffset)
|
||||
+ + node->ino_chunk,
|
||||
+ node->ino_offset + (node->ino.symlink.name
|
||||
+ - (char *) &node->ino));
|
||||
+ if (err)
|
||||
+ {
|
||||
+ grub_free (ret);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ ret[grub_le_to_cpu32 (node->ino.symlink.namelen)] = 0;
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
+grub_squash_iterate_dir (grub_fshelp_node_t dir,
|
||||
+ int NESTED_FUNC_ATTR
|
||||
+ (*hook) (const char *filename,
|
||||
+ enum grub_fshelp_filetype filetype,
|
||||
+ grub_fshelp_node_t node))
|
||||
+{
|
||||
+ grub_uint32_t off = grub_le_to_cpu16 (dir->ino.dir.offset);
|
||||
+ grub_uint32_t endoff;
|
||||
+ unsigned i;
|
||||
+
|
||||
+ /* FIXME: why - 3 ? */
|
||||
+ endoff = grub_le_to_cpu32 (dir->ino.dir.size) + off - 3;
|
||||
+
|
||||
+ while (off < endoff)
|
||||
+ {
|
||||
+ struct grub_squash_dirent_header dh;
|
||||
+ grub_err_t err;
|
||||
+
|
||||
+ err = read_chunk (dir->data->disk, &dh, sizeof (dh),
|
||||
+ grub_le_to_cpu64 (dir->data->sb.diroffset)
|
||||
+ + grub_le_to_cpu32 (dir->ino.dir.chunk), off);
|
||||
+ if (err)
|
||||
+ return 0;
|
||||
+ off += sizeof (dh);
|
||||
+ for (i = 0; i < (unsigned) grub_le_to_cpu16 (dh.nelems) + 1; i++)
|
||||
+ {
|
||||
+ char *buf;
|
||||
+ int r;
|
||||
+ struct grub_fshelp_node *node;
|
||||
+ enum grub_fshelp_filetype filetype = GRUB_FSHELP_REG;
|
||||
+ struct grub_squash_dirent di;
|
||||
+ struct grub_squash_inode ino;
|
||||
+
|
||||
+ err = read_chunk (dir->data->disk, &di, sizeof (di),
|
||||
+ grub_le_to_cpu64 (dir->data->sb.diroffset)
|
||||
+ + grub_le_to_cpu32 (dir->ino.dir.chunk), off);
|
||||
+ if (err)
|
||||
+ return 0;
|
||||
+ off += sizeof (di);
|
||||
+
|
||||
+ err = read_chunk (dir->data->disk, &ino, sizeof (ino),
|
||||
+ grub_le_to_cpu64 (dir->data->sb.inodeoffset)
|
||||
+ + grub_le_to_cpu32 (dh.ino_chunk),
|
||||
+ grub_cpu_to_le16 (di.ino_offset));
|
||||
+ if (err)
|
||||
+ return 0;
|
||||
+
|
||||
+ buf = grub_malloc (grub_le_to_cpu16 (di.namelen) + 2);
|
||||
+ if (!buf)
|
||||
+ return 0;
|
||||
+ err = read_chunk (dir->data->disk, buf,
|
||||
+ grub_le_to_cpu16 (di.namelen) + 1,
|
||||
+ grub_le_to_cpu64 (dir->data->sb.diroffset)
|
||||
+ + grub_le_to_cpu32 (dir->ino.dir.chunk), off);
|
||||
+ if (err)
|
||||
+ return 0;
|
||||
+
|
||||
+ off += grub_le_to_cpu16 (di.namelen) + 1;
|
||||
+ buf[grub_le_to_cpu16 (di.namelen) + 1] = 0;
|
||||
+ if (grub_le_to_cpu16 (di.type) == SQUASH_TYPE_DIR)
|
||||
+ filetype = GRUB_FSHELP_DIR;
|
||||
+ if (grub_le_to_cpu16 (di.type) == SQUASH_TYPE_SYMLINK)
|
||||
+ filetype = GRUB_FSHELP_SYMLINK;
|
||||
+
|
||||
+ node = grub_malloc (sizeof (*node));
|
||||
+ if (! node)
|
||||
+ return 0;
|
||||
+ *node = *dir;
|
||||
+ node->ino = ino;
|
||||
+ node->ino_chunk = grub_le_to_cpu32 (dh.ino_chunk);
|
||||
+ node->ino_offset = grub_le_to_cpu16 (di.ino_offset);
|
||||
+
|
||||
+ r = hook (buf, filetype, node);
|
||||
+
|
||||
+ grub_free (buf);
|
||||
+ if (r)
|
||||
+ return r;
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+make_root_node (struct grub_squash_data *data, struct grub_fshelp_node *root)
|
||||
+{
|
||||
+ grub_memset (root, 0, sizeof (*root));
|
||||
+ root->data = data;
|
||||
+
|
||||
+ return read_chunk (data->disk, &root->ino, sizeof (root->ino),
|
||||
+ grub_le_to_cpu64 (data->sb.inodeoffset)
|
||||
+ + grub_le_to_cpu16 (data->sb.root_ino_chunk),
|
||||
+ grub_cpu_to_le16 (data->sb.root_ino_offset));
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_squash_dir (grub_device_t device, const char *path,
|
||||
+ int (*hook) (const char *filename,
|
||||
+ const struct grub_dirhook_info *info))
|
||||
+{
|
||||
+ auto int NESTED_FUNC_ATTR iterate (const char *filename,
|
||||
+ enum grub_fshelp_filetype filetype,
|
||||
+ grub_fshelp_node_t node);
|
||||
+
|
||||
+ int NESTED_FUNC_ATTR iterate (const char *filename,
|
||||
+ enum grub_fshelp_filetype filetype,
|
||||
+ grub_fshelp_node_t node)
|
||||
+ {
|
||||
+ struct grub_dirhook_info info;
|
||||
+ grub_memset (&info, 0, sizeof (info));
|
||||
+ info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
+ info.mtimeset = 1;
|
||||
+ info.mtime = grub_le_to_cpu32 (node->ino.mtime);
|
||||
+ return hook (filename, &info);
|
||||
+ }
|
||||
+
|
||||
+ struct grub_squash_data *data = 0;
|
||||
+ struct grub_fshelp_node *fdiro = 0;
|
||||
+ struct grub_fshelp_node root;
|
||||
+ grub_err_t err;
|
||||
+
|
||||
+ data = squash_mount (device->disk);
|
||||
+ if (! data)
|
||||
+ return grub_errno;
|
||||
+
|
||||
+ err = make_root_node (data, &root);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ grub_fshelp_find_file (path, &root, &fdiro, grub_squash_iterate_dir,
|
||||
+ grub_squash_read_symlink, GRUB_FSHELP_DIR);
|
||||
+ if (!grub_errno)
|
||||
+ grub_squash_iterate_dir (fdiro, iterate);
|
||||
+
|
||||
+ grub_free (data);
|
||||
+
|
||||
+ return grub_errno;
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_squash_open (struct grub_file *file, const char *name)
|
||||
+{
|
||||
+ struct grub_squash_data *data = 0;
|
||||
+ struct grub_fshelp_node *fdiro = 0;
|
||||
+ struct grub_fshelp_node root;
|
||||
+ grub_err_t err;
|
||||
+
|
||||
+ data = squash_mount (file->device->disk);
|
||||
+ if (! data)
|
||||
+ return grub_errno;
|
||||
+
|
||||
+ err = make_root_node (data, &root);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ grub_fshelp_find_file (name, &root, &fdiro, grub_squash_iterate_dir,
|
||||
+ grub_squash_read_symlink, GRUB_FSHELP_REG);
|
||||
+ if (grub_errno)
|
||||
+ {
|
||||
+ grub_free (data);
|
||||
+ return grub_errno;
|
||||
+ }
|
||||
+
|
||||
+ file->data = data;
|
||||
+ data->ino = fdiro->ino;
|
||||
+ file->size = grub_le_to_cpu32 (fdiro->ino.file.size);
|
||||
+
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static grub_ssize_t
|
||||
+grub_squash_read_data (struct grub_squash_data *data,
|
||||
+ grub_disk_t disk, const struct grub_squash_inode *ino,
|
||||
+ grub_off_t off, char *buf, grub_size_t len)
|
||||
+{
|
||||
+ grub_err_t err;
|
||||
+ grub_uint64_t a, b;
|
||||
+ int compressed = 0;
|
||||
+
|
||||
+ if (grub_le_to_cpu16 (ino->file.fragment) == 0xffff)
|
||||
+ {
|
||||
+ if (grub_le_to_cpu32 (ino->file.chunk))
|
||||
+ a = grub_le_to_cpu32 (ino->file.chunk);
|
||||
+ else
|
||||
+ a = sizeof (struct grub_squash_super);
|
||||
+ compressed = !(data->sb.flags & SQUASH_FLAG_UNCOMPRESSED_DATA);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ struct grub_squash_frag_desc frag;
|
||||
+ err = read_chunk (disk, &frag, sizeof (frag),
|
||||
+ data->fragments, sizeof (frag)
|
||||
+ * grub_le_to_cpu16 (ino->file.fragment));
|
||||
+ if (err)
|
||||
+ return -1;
|
||||
+ a = grub_le_to_cpu64 (frag.offset) + grub_le_to_cpu32 (ino->file.chunk);
|
||||
+ compressed = !(data->sb.flags & SQUASH_FLAG_UNCOMPRESSED_FRAGMENTS);
|
||||
+ }
|
||||
+
|
||||
+ b = grub_le_to_cpu32 (data->ino.file.offset) + off;
|
||||
+
|
||||
+ /* FIXME: cache uncompressed chunks. */
|
||||
+ if (compressed)
|
||||
+ err = grub_zlib_disk_read (disk, a, b, buf, len);
|
||||
+ else
|
||||
+ err = grub_disk_read (disk, (a + b) >> GRUB_DISK_SECTOR_BITS,
|
||||
+ (a + b) & (GRUB_DISK_SECTOR_SIZE - 1), len, buf);
|
||||
+ if (err)
|
||||
+ return -1;
|
||||
+ return len;
|
||||
+}
|
||||
+
|
||||
+static grub_ssize_t
|
||||
+grub_squash_read (grub_file_t file, char *buf, grub_size_t len)
|
||||
+{
|
||||
+ struct grub_squash_data *data = file->data;
|
||||
+
|
||||
+ return grub_squash_read_data (data, file->device->disk, &data->ino,
|
||||
+ file->offset, buf, len);
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_squash_close (grub_file_t file)
|
||||
+{
|
||||
+ grub_free (file->data);
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_squash_mtime (grub_device_t dev, grub_int32_t *tm)
|
||||
+{
|
||||
+ struct grub_squash_data *data = 0;
|
||||
+
|
||||
+ data = squash_mount (dev->disk);
|
||||
+ if (! data)
|
||||
+ return grub_errno;
|
||||
+ *tm = grub_le_to_cpu32 (data->sb.creation_time);
|
||||
+ grub_free (data);
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static struct grub_fs grub_squash_fs =
|
||||
+ {
|
||||
+ .name = "squash4",
|
||||
+ .dir = grub_squash_dir,
|
||||
+ .open = grub_squash_open,
|
||||
+ .read = grub_squash_read,
|
||||
+ .close = grub_squash_close,
|
||||
+ .mtime = grub_squash_mtime,
|
||||
+#ifdef GRUB_UTIL
|
||||
+ .reserved_first_sector = 0,
|
||||
+#endif
|
||||
+ .next = 0
|
||||
+ };
|
||||
+
|
||||
+GRUB_MOD_INIT(squash4)
|
||||
+{
|
||||
+ grub_fs_register (&grub_squash_fs);
|
||||
+}
|
||||
+
|
||||
+GRUB_MOD_FINI(squash4)
|
||||
+{
|
||||
+ grub_fs_unregister (&grub_squash_fs);
|
||||
+}
|
||||
+
|
||||
Index: b/grub-core/io/gzio.c
|
||||
===================================================================
|
||||
--- a/grub-core/io/gzio.c
|
||||
+++ b/grub-core/io/gzio.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <grub/fs.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/dl.h>
|
||||
+#include <grub/disk.h>
|
||||
#include <grub/deflate.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
@@ -64,6 +65,9 @@
|
||||
/* If input is in memory following fields are used instead of file. */
|
||||
grub_size_t mem_input_size, mem_input_off;
|
||||
grub_uint8_t *mem_input;
|
||||
+ grub_disk_addr_t disk_input_off;
|
||||
+ grub_disk_addr_t disk_input_start;
|
||||
+ grub_disk_t disk_input;
|
||||
/* The offset at which the data starts in the underlying file. */
|
||||
grub_off_t data_offset;
|
||||
/* The type of current block. */
|
||||
@@ -384,8 +388,21 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (grub_file_tell (gzio->file) == (grub_off_t) gzio->data_offset
|
||||
- || gzio->inbuf_d == INBUFSIZ)
|
||||
+ if (gzio->disk_input && (gzio->disk_input_off == gzio->data_offset
|
||||
+ || gzio->inbuf_d == INBUFSIZ))
|
||||
+ {
|
||||
+ grub_disk_addr_t d = gzio->disk_input_start + gzio->disk_input_off;
|
||||
+ gzio->inbuf_d = 0;
|
||||
+ grub_disk_read (gzio->disk_input,
|
||||
+ d >> GRUB_DISK_SECTOR_BITS,
|
||||
+ d & (GRUB_DISK_SECTOR_SIZE - 1),
|
||||
+ INBUFSIZ, gzio->inbuf);
|
||||
+ gzio->disk_input_off += INBUFSIZ;
|
||||
+ }
|
||||
+
|
||||
+ if (gzio->file && (grub_file_tell (gzio->file)
|
||||
+ == (grub_off_t) gzio->data_offset
|
||||
+ || gzio->inbuf_d == INBUFSIZ))
|
||||
{
|
||||
gzio->inbuf_d = 0;
|
||||
grub_file_read (gzio->file, gzio->inbuf, INBUFSIZ);
|
||||
@@ -403,8 +420,10 @@
|
||||
grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"attempt to seek outside of the file");
|
||||
else
|
||||
- gzio->mem_input_off = gzio->data_offset;
|
||||
+ gzio->mem_input_off = off;
|
||||
}
|
||||
+ else if (gzio->disk_input)
|
||||
+ gzio->disk_input_off = off;
|
||||
else
|
||||
grub_file_seek (gzio->file, off);
|
||||
}
|
||||
@@ -1298,6 +1317,34 @@
|
||||
return ret;
|
||||
}
|
||||
|
||||
+grub_err_t
|
||||
+grub_zlib_disk_read (grub_disk_t disk, grub_disk_addr_t zlibstart,
|
||||
+ grub_off_t off, char *outbuf, grub_size_t outsize)
|
||||
+{
|
||||
+ grub_gzio_t gzio = 0;
|
||||
+ grub_ssize_t ret;
|
||||
+
|
||||
+ gzio = grub_zalloc (sizeof (*gzio));
|
||||
+ if (! gzio)
|
||||
+ return -1;
|
||||
+
|
||||
+ gzio->disk_input_off = 0;
|
||||
+ gzio->disk_input_start = zlibstart;
|
||||
+ gzio->disk_input = disk;
|
||||
+
|
||||
+ if (!test_zlib_header (gzio))
|
||||
+ {
|
||||
+ grub_free (gzio);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ ret = grub_gzio_read_real (gzio, off, outbuf, outsize);
|
||||
+ grub_free (gzio);
|
||||
+
|
||||
+ /* FIXME: Check Adler. */
|
||||
+ return ret < 0 ? grub_errno : GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
|
||||
|
||||
static struct grub_fs grub_gzio_fs =
|
||||
Index: b/include/grub/deflate.h
|
||||
===================================================================
|
||||
--- a/include/grub/deflate.h
|
||||
+++ b/include/grub/deflate.h
|
||||
@@ -23,4 +23,8 @@
|
||||
grub_zlib_decompress (char *inbuf, grub_size_t insize, grub_off_t off,
|
||||
char *outbuf, grub_size_t outsize);
|
||||
|
||||
+grub_err_t
|
||||
+grub_zlib_disk_read (grub_disk_t disk, grub_disk_addr_t zlibstart,
|
||||
+ grub_off_t off, char *outbuf, grub_size_t outsize);
|
||||
+
|
||||
#endif
|
36
debian/patches/btrfs_stat.patch
vendored
36
debian/patches/btrfs_stat.patch
vendored
@ -1,36 +0,0 @@
|
||||
Description: Cope with btrfs / inside an encrypted block device
|
||||
If / is inside an encrypted block device, then grub-probe can't tell what
|
||||
its filesystem type is. Work around this.
|
||||
Author: alexeagar@gmail.com
|
||||
Bug-Ubuntu: https://bugs.launchpad.net/bugs/757631
|
||||
Forwarded: no
|
||||
Last-Update: 2011-06-15
|
||||
|
||||
Index: b/util/grub.d/10_linux.in
|
||||
===================================================================
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -56,7 +56,8 @@
|
||||
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
|
||||
fi
|
||||
|
||||
-if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then
|
||||
+if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ] \
|
||||
+ || [ "x`stat -f --printf=%T /`" = xbtrfs ]; then
|
||||
rootsubvol="`make_system_path_relative_to_its_root /`"
|
||||
rootsubvol="${rootsubvol#/}"
|
||||
if [ "x${rootsubvol}" != x ]; then
|
||||
Index: b/util/grub.d/20_linux_xen.in
|
||||
===================================================================
|
||||
--- a/util/grub.d/20_linux_xen.in
|
||||
+++ b/util/grub.d/20_linux_xen.in
|
||||
@@ -56,7 +56,8 @@
|
||||
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
|
||||
fi
|
||||
|
||||
-if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then
|
||||
+if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ] \
|
||||
+ || [ "x`stat -f --printf=%T /`" = xbtrfs ]; then
|
||||
rootsubvol="`make_system_path_relative_to_its_root /`"
|
||||
rootsubvol="${rootsubvol#/}"
|
||||
if [ "x${rootsubvol}" != x ]; then
|
10
debian/patches/core_in_fs.patch
vendored
10
debian/patches/core_in_fs.patch
vendored
@ -2,15 +2,15 @@ Index: b/util/grub-setup.c
|
||||
===================================================================
|
||||
--- a/util/grub-setup.c
|
||||
+++ b/util/grub-setup.c
|
||||
@@ -76,6 +76,7 @@
|
||||
@@ -85,6 +85,7 @@
|
||||
|
||||
#define DEFAULT_BOOT_FILE "boot.img"
|
||||
#define DEFAULT_CORE_FILE "core.img"
|
||||
+#define CORE_IMG_IN_FS "setup_left_core_image_in_filesystem"
|
||||
|
||||
#ifdef GRUB_MACHINE_SPARC64
|
||||
#ifdef GRUB_SETUP_SPARC64
|
||||
#define grub_target_to_host16(x) grub_be_to_cpu16(x)
|
||||
@@ -489,6 +490,8 @@
|
||||
@@ -556,6 +557,8 @@
|
||||
|
||||
grub_free (sectors);
|
||||
|
||||
@ -18,8 +18,8 @@ Index: b/util/grub-setup.c
|
||||
+
|
||||
goto finish;
|
||||
}
|
||||
#endif
|
||||
@@ -514,6 +517,9 @@
|
||||
|
||||
@@ -598,6 +601,9 @@
|
||||
/* The core image must be put on a filesystem unfortunately. */
|
||||
grub_util_info ("will leave the core image on the filesystem");
|
||||
|
||||
|
19
debian/patches/dirlen.patch
vendored
19
debian/patches/dirlen.patch
vendored
@ -1,19 +0,0 @@
|
||||
Description: Ignore entries with direct.inode = 0.
|
||||
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||
Origin: upstream, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3749
|
||||
Forwarded: not-needed
|
||||
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3749
|
||||
Last-Update: 2012-06-08
|
||||
|
||||
--- a/grub-core/fs/ext2.c 2012-01-14 10:30:43 +0000
|
||||
+++ b/grub-core/fs/ext2.c 2012-01-14 10:55:20 +0000
|
||||
@@ -685,7 +685,7 @@ grub_ext2_iterate_dir (grub_fshelp_node_
|
||||
if (dirent.direntlen == 0)
|
||||
return 0;
|
||||
|
||||
- if (dirent.namelen != 0)
|
||||
+ if (dirent.inode != 0 && dirent.namelen != 0)
|
||||
{
|
||||
char filename[dirent.namelen + 1];
|
||||
struct grub_fshelp_node *fdiro;
|
||||
|
2
debian/patches/disable_floppies.patch
vendored
2
debian/patches/disable_floppies.patch
vendored
@ -7,7 +7,7 @@ Index: b/grub-core/kern/emu/hostdisk.c
|
||||
===================================================================
|
||||
--- a/grub-core/kern/emu/hostdisk.c
|
||||
+++ b/grub-core/kern/emu/hostdisk.c
|
||||
@@ -1077,6 +1077,18 @@
|
||||
@@ -1331,6 +1331,18 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
|
26
debian/patches/dpkg_version_comparison.patch
vendored
26
debian/patches/dpkg_version_comparison.patch
vendored
@ -7,24 +7,24 @@ Index: b/util/grub-mkconfig_lib.in
|
||||
===================================================================
|
||||
--- a/util/grub-mkconfig_lib.in
|
||||
+++ b/util/grub-mkconfig_lib.in
|
||||
@@ -172,8 +172,9 @@
|
||||
@@ -229,8 +229,9 @@
|
||||
|
||||
version_test_gt ()
|
||||
{
|
||||
- local a="`echo "$1" | sed -e "s/[^-]*-//"`"
|
||||
- local b="`echo "$2" | sed -e "s/[^-]*-//"`"
|
||||
+ local sedexp="s/[^-]*-//;s/[._-]\(pre\|rc\|test\|git\|old\|trunk\)/~\1/g"
|
||||
+ local a="`echo "$1" | sed -e "$sedexp"`"
|
||||
+ local b="`echo "$2" | sed -e "$sedexp"`"
|
||||
local cmp=gt
|
||||
if [ "x$b" = "x" ] ; then
|
||||
- version_test_gt_a="`echo "$1" | sed -e "s/[^-]*-//"`"
|
||||
- version_test_gt_b="`echo "$2" | sed -e "s/[^-]*-//"`"
|
||||
+ version_test_gt_sedexp="s/[^-]*-//;s/[._-]\(pre\|rc\|test\|git\|old\|trunk\)/~\1/g"
|
||||
+ version_test_gt_a="`echo "$1" | sed -e "$version_test_gt_sedexp"`"
|
||||
+ version_test_gt_b="`echo "$2" | sed -e "$version_test_gt_sedexp"`"
|
||||
version_test_gt_cmp=gt
|
||||
if [ "x$version_test_gt_b" = "x" ] ; then
|
||||
return 0
|
||||
@@ -183,7 +184,7 @@
|
||||
*.old:*) a="`echo -n "$a" | sed -e 's/\.old$//'`" ; cmp=gt ;;
|
||||
*:*.old) b="`echo -n "$b" | sed -e 's/\.old$//'`" ; cmp=ge ;;
|
||||
@@ -240,7 +241,7 @@
|
||||
*.old:*) version_test_gt_a="`echo -n "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;;
|
||||
*:*.old) version_test_gt_b="`echo -n "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;;
|
||||
esac
|
||||
- version_test_numeric "$a" "$cmp" "$b"
|
||||
+ dpkg --compare-versions "$a" $cmp "$b"
|
||||
- version_test_numeric "$version_test_gt_a" "$version_test_gt_cmp" "$version_test_gt_b"
|
||||
+ dpkg --compare-versions "$version_test_gt_a" "$version_test_gt_cmp" "$version_test_gt_b"
|
||||
return "$?"
|
||||
}
|
||||
|
||||
|
2
debian/patches/efi_disk_cache.patch
vendored
2
debian/patches/efi_disk_cache.patch
vendored
@ -12,7 +12,7 @@ Index: b/include/grub/disk.h
|
||||
===================================================================
|
||||
--- a/include/grub/disk.h
|
||||
+++ b/include/grub/disk.h
|
||||
@@ -137,7 +137,11 @@
|
||||
@@ -146,7 +146,11 @@
|
||||
|
||||
/* The size of a disk cache in 512B units. Must be at least as big as the
|
||||
largest supported sector size, currently 16K. */
|
||||
|
134
debian/patches/efiemu_fix.patch
vendored
134
debian/patches/efiemu_fix.patch
vendored
@ -1,134 +0,0 @@
|
||||
Description: Fix efiemu
|
||||
Without this, lzo.patch causes efiemu not to be built.
|
||||
Author: Vladimir Serbinenko <phcoder@gmail.com>
|
||||
Origin: upstream, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3740
|
||||
Origin: upstream, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/4066
|
||||
Forwarded: not-needed
|
||||
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3740
|
||||
Last-Update: 2012-03-19
|
||||
|
||||
Index: b/configure.ac
|
||||
===================================================================
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -479,6 +479,42 @@
|
||||
esac
|
||||
AC_MSG_RESULT([$TARGET_OBJ2ELF])
|
||||
|
||||
+
|
||||
+AC_ARG_ENABLE([efiemu],
|
||||
+ [AS_HELP_STRING([--enable-efiemu],
|
||||
+ [build and install the efiemu runtimes (default=guessed)])])
|
||||
+if test x"$enable_efiemu" = xno ; then
|
||||
+ efiemu_excuse="explicitly disabled"
|
||||
+fi
|
||||
+if test x"$target_cpu" != xi386 ; then
|
||||
+ efiemu_excuse="only available on i386"
|
||||
+fi
|
||||
+if test x"$platform" = xefi ; then
|
||||
+ efiemu_excuse="not available on efi"
|
||||
+fi
|
||||
+if test x"$efiemu_excuse" = x ; then
|
||||
+ AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
|
||||
+ SAVED_CFLAGS="$CFLAGS"
|
||||
+ CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
|
||||
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
+ [grub_cv_cc_efiemu=yes],
|
||||
+ [grub_cv_cc_efiemu=no])
|
||||
+ CFLAGS="$SAVED_CFLAGS"
|
||||
+ ])
|
||||
+ if test x$grub_cv_cc_efiemu = xno; then
|
||||
+ efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
|
||||
+ fi
|
||||
+fi
|
||||
+if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
|
||||
+ AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
|
||||
+fi
|
||||
+if test x"$efiemu_excuse" = x ; then
|
||||
+enable_efiemu=yes
|
||||
+else
|
||||
+enable_efiemu=no
|
||||
+fi
|
||||
+AC_SUBST([enable_efiemu])
|
||||
+
|
||||
if test "x$target_m32" = x1; then
|
||||
# Force 32-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
||||
@@ -638,39 +674,6 @@
|
||||
grub_I386_ASM_ADDR32
|
||||
fi
|
||||
|
||||
-AC_ARG_ENABLE([efiemu],
|
||||
- [AS_HELP_STRING([--enable-efiemu],
|
||||
- [build and install the efiemu runtimes (default=guessed)])])
|
||||
-if test x"$enable_efiemu" = xno ; then
|
||||
- efiemu_excuse="explicitly disabled"
|
||||
-fi
|
||||
-if test x"$target_cpu" != xi386 ; then
|
||||
- efiemu_excuse="only available on i386"
|
||||
-fi
|
||||
-if test x"$platform" = xefi ; then
|
||||
- efiemu_excuse="not available on efi"
|
||||
-fi
|
||||
-if test x"$efiemu_excuse" = x ; then
|
||||
- AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
|
||||
- CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
|
||||
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
- [grub_cv_cc_efiemu=yes],
|
||||
- [grub_cv_cc_efiemu=no])
|
||||
- ])
|
||||
- if test x$grub_cv_cc_efiemu = xno; then
|
||||
- efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
|
||||
- fi
|
||||
-fi
|
||||
-if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
|
||||
- AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
|
||||
-fi
|
||||
-if test x"$efiemu_excuse" = x ; then
|
||||
-enable_efiemu=yes
|
||||
-else
|
||||
-enable_efiemu=no
|
||||
-fi
|
||||
-AC_SUBST([enable_efiemu])
|
||||
-
|
||||
if test "$platform" != emu; then
|
||||
AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
|
||||
SAVED_CPPFLAGS="$CPPFLAGS"
|
||||
Index: b/grub-core/efiemu/runtime/efiemu.c
|
||||
===================================================================
|
||||
--- a/grub-core/efiemu/runtime/efiemu.c
|
||||
+++ b/grub-core/efiemu/runtime/efiemu.c
|
||||
@@ -21,6 +21,12 @@
|
||||
As it emulates only runtime serviceit isn't able
|
||||
to chainload EFI bootloader on non-EFI system (TODO) */
|
||||
|
||||
+#ifdef __i386__
|
||||
+#include <grub/i386/types.h>
|
||||
+#else
|
||||
+#include <grub/x86_64/types.h>
|
||||
+#endif
|
||||
+
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/efi/api.h>
|
||||
@@ -369,16 +375,16 @@
|
||||
switch (cur_relloc->size)
|
||||
{
|
||||
case 8:
|
||||
- *((grub_uint64_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
|
||||
+ *((grub_uint64_t *) (grub_addr_t) cur_relloc->addr) += corr;
|
||||
break;
|
||||
case 4:
|
||||
- *((grub_uint32_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
|
||||
+ *((grub_uint32_t *) (grub_addr_t) cur_relloc->addr) += corr;
|
||||
break;
|
||||
case 2:
|
||||
- *((grub_uint16_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
|
||||
+ *((grub_uint16_t *) (grub_addr_t) cur_relloc->addr) += corr;
|
||||
break;
|
||||
case 1:
|
||||
- *((grub_uint8_t *) UINT_TO_PTR (cur_relloc->addr)) += corr;
|
||||
+ *((grub_uint8_t *) (grub_addr_t) cur_relloc->addr) += corr;
|
||||
break;
|
||||
}
|
||||
}
|
25
debian/patches/fat_uuid.patch
vendored
25
debian/patches/fat_uuid.patch
vendored
@ -1,25 +0,0 @@
|
||||
Description: Make FAT UUID uppercase to match Linux
|
||||
Author: Vladimir Serbinenko <phcoder@gmail.com>
|
||||
Origin: upstream, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3482
|
||||
Bug-Ubuntu: https://bugs.launchpad.net/bugs/948716
|
||||
Forwarded: not-needed
|
||||
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3482
|
||||
Last-Update: 2012-03-19
|
||||
|
||||
Index: b/grub-core/fs/fat.c
|
||||
===================================================================
|
||||
--- a/grub-core/fs/fat.c
|
||||
+++ b/grub-core/fs/fat.c
|
||||
@@ -836,9 +836,12 @@
|
||||
data = grub_fat_mount (disk);
|
||||
if (data)
|
||||
{
|
||||
+ char *ptr;
|
||||
*uuid = grub_xasprintf ("%04x-%04x",
|
||||
(grub_uint16_t) (data->uuid >> 16),
|
||||
(grub_uint16_t) data->uuid);
|
||||
+ for (ptr = *uuid; ptr && *ptr; ptr++)
|
||||
+ *ptr = grub_toupper (*ptr);
|
||||
}
|
||||
else
|
||||
*uuid = NULL;
|
33
debian/patches/gcc_4_6_space.patch
vendored
33
debian/patches/gcc_4_6_space.patch
vendored
@ -1,33 +0,0 @@
|
||||
Description: Build with -fno-asynchronous-unwind-tables to save space
|
||||
Author: Vladimir Serbinenko <phcoder@gmail.com>
|
||||
Origin: upstream, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3589
|
||||
Last-Update: 2012-03-06
|
||||
|
||||
Index: b/configure.ac
|
||||
===================================================================
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -415,6 +415,23 @@
|
||||
fi
|
||||
fi
|
||||
|
||||
+# By default, GCC 4.6 generates .eh_frame sections containing unwind
|
||||
+# information in some cases where it previously did not. GRUB doesn't need
|
||||
+# these and they just use up vital space. Restore the old compiler
|
||||
+# behaviour.
|
||||
+AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
|
||||
+ SAVE_CFLAGS="$CFLAGS"
|
||||
+ CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
|
||||
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
+ [grub_cv_cc_fno_asynchronous_unwind_tables=yes],
|
||||
+ [grub_cv_cc_fno_asynchronous_unwind_tables=no])
|
||||
+ CFLAGS="$SAVE_CFLAGS"
|
||||
+])
|
||||
+
|
||||
+if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
|
||||
+ TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
|
||||
+fi
|
||||
+
|
||||
grub_apple_target_cc
|
||||
if test x$grub_cv_apple_target_cc = xyes ; then
|
||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DAPPLE_CC=1"
|
14
debian/patches/gfxpayload_keep_default.patch
vendored
14
debian/patches/gfxpayload_keep_default.patch
vendored
@ -17,22 +17,18 @@ Index: b/util/grub.d/10_linux.in
|
||||
===================================================================
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -77,17 +77,7 @@
|
||||
@@ -106,13 +106,7 @@
|
||||
|
||||
# Use ELILO's generic "efifb" when it's known to be available.
|
||||
# FIXME: We need an interface to select vesafb in case efifb can't be used.
|
||||
- if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then
|
||||
- cat << EOF
|
||||
- load_video
|
||||
-EOF
|
||||
- echo " load_video" | sed "s/^/$submenu_indentation/"
|
||||
- if grep -qx "CONFIG_FB_EFI=y" "${config}" 2> /dev/null \
|
||||
- && grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" "${config}" 2> /dev/null; then
|
||||
- cat << EOF
|
||||
- set gfxpayload=keep
|
||||
-EOF
|
||||
- echo " set gfxpayload=keep" | sed "s/^/$submenu_indentation/"
|
||||
- fi
|
||||
- else
|
||||
+ if [ "x$GRUB_GFXPAYLOAD_LINUX" != x ]; then
|
||||
if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then
|
||||
cat << EOF
|
||||
load_video
|
||||
echo " load_video" | sed "s/^/$submenu_indentation/"
|
||||
fi
|
||||
|
69
debian/patches/gfxterm_background.patch
vendored
69
debian/patches/gfxterm_background.patch
vendored
@ -1,69 +0,0 @@
|
||||
Description: Fix gfxterm background_color regression
|
||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||
Forwarded: http://lists.gnu.org/archive/html/grub-devel/2011-06/msg00085.html
|
||||
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3368
|
||||
Last-Update: 2011-06-28
|
||||
|
||||
Index: b/grub-core/term/gfxterm.c
|
||||
===================================================================
|
||||
--- a/grub-core/term/gfxterm.c
|
||||
+++ b/grub-core/term/gfxterm.c
|
||||
@@ -131,6 +131,7 @@
|
||||
static unsigned int bitmap_height;
|
||||
static struct grub_video_bitmap *bitmap;
|
||||
static int blend_text_bg;
|
||||
+static grub_video_rgba_color_t default_bg_color = { 0, 0, 0, 0 };
|
||||
|
||||
static struct grub_dirty_region dirty_region;
|
||||
|
||||
@@ -266,7 +267,8 @@
|
||||
|
||||
grub_video_set_active_render_target (render_target);
|
||||
|
||||
- virtual_screen.bg_color_display = grub_video_map_rgba(0, 0, 0, 0);
|
||||
+ virtual_screen.bg_color_display =
|
||||
+ grub_video_map_rgba_color (default_bg_color);
|
||||
|
||||
/* Clear out text buffer. */
|
||||
for (i = 0; i < virtual_screen.columns * virtual_screen.rows; i++)
|
||||
@@ -338,8 +340,8 @@
|
||||
double_redraw = mode_info.mode_type & GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED
|
||||
&& !(mode_info.mode_type & GRUB_VIDEO_MODE_TYPE_UPDATING_SWAP);
|
||||
|
||||
- /* Make sure screen is black. */
|
||||
- color = grub_video_map_rgb (0, 0, 0);
|
||||
+ /* Make sure screen is set to the default background color. */
|
||||
+ color = grub_video_map_rgba_color (default_bg_color);
|
||||
grub_video_fill_rect (color, 0, 0, mode_info.width, mode_info.height);
|
||||
if (double_redraw)
|
||||
{
|
||||
@@ -1189,7 +1191,6 @@
|
||||
grub_gfxterm_background_color_cmd (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
{
|
||||
- grub_video_rgba_color_t color;
|
||||
struct grub_video_render_target *old_target;
|
||||
|
||||
if (argc != 1)
|
||||
@@ -1199,7 +1200,7 @@
|
||||
if (grub_video_get_info (NULL) != GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
|
||||
- if (grub_video_parse_color (args[0], &color) != GRUB_ERR_NONE)
|
||||
+ if (grub_video_parse_color (args[0], &default_bg_color) != GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
|
||||
/* Destroy existing background bitmap if loaded. */
|
||||
@@ -1216,9 +1217,10 @@
|
||||
compatible with the text layer. */
|
||||
grub_video_get_active_render_target (&old_target);
|
||||
grub_video_set_active_render_target (text_layer);
|
||||
- virtual_screen.bg_color = grub_video_map_rgba_color (color);
|
||||
+ virtual_screen.bg_color = grub_video_map_rgba_color (default_bg_color);
|
||||
grub_video_set_active_render_target (old_target);
|
||||
- virtual_screen.bg_color_display = grub_video_map_rgba_color (color);
|
||||
+ virtual_screen.bg_color_display =
|
||||
+ grub_video_map_rgba_color (default_bg_color);
|
||||
blend_text_bg = 1;
|
||||
|
||||
/* Mark whole screen as dirty. */
|
4
debian/patches/grub.cfg_400.patch
vendored
4
debian/patches/grub.cfg_400.patch
vendored
@ -2,7 +2,7 @@ Index: b/util/grub-mkconfig.in
|
||||
===================================================================
|
||||
--- a/util/grub-mkconfig.in
|
||||
+++ b/util/grub-mkconfig.in
|
||||
@@ -293,6 +293,10 @@
|
||||
@@ -253,6 +253,10 @@
|
||||
esac
|
||||
done
|
||||
|
||||
@ -12,4 +12,4 @@ Index: b/util/grub-mkconfig.in
|
||||
+
|
||||
if test "x${grub_cfg}" != "x" ; then
|
||||
if ! ${grub_script_check} ${grub_cfg}.new; then
|
||||
echo "Syntax errors are detected in generated GRUB config file." >&2
|
||||
# TRANSLATORS: %s is replaced by filename
|
||||
|
@ -1,17 +1,17 @@
|
||||
Index: b/grub-core/kern/emu/hostdisk.c
|
||||
Index: b/util/getroot.c
|
||||
===================================================================
|
||||
--- a/grub-core/kern/emu/hostdisk.c
|
||||
+++ b/grub-core/kern/emu/hostdisk.c
|
||||
@@ -1131,7 +1131,7 @@
|
||||
char *bsd_part_str = NULL;
|
||||
|
||||
--- a/util/getroot.c
|
||||
+++ b/util/getroot.c
|
||||
@@ -2144,7 +2144,7 @@
|
||||
}
|
||||
*ptr = 0;
|
||||
if (dos_part >= 0)
|
||||
- dos_part_str = xasprintf (",%d", dos_part + 1);
|
||||
+ dos_part_str = xasprintf (",%d", dos_part + (getenv ("GRUB_LEGACY_0_BASED_PARTITIONS") ? 0 : 1));
|
||||
|
||||
- snprintf (ptr, end - ptr, ",%d", dos_part + 1);
|
||||
+ snprintf (ptr, end - ptr, ",%d", dos_part + (getenv ("GRUB_LEGACY_0_BASED_PARTITIONS") ? 0 : 1));
|
||||
ptr += strlen (ptr);
|
||||
if (bsd_part >= 0)
|
||||
bsd_part_str = xasprintf (",%d", bsd_part + 1);
|
||||
@@ -1619,6 +1619,29 @@
|
||||
snprintf (ptr, end - ptr, ",%d", bsd_part + 1);
|
||||
@@ -2241,6 +2241,29 @@
|
||||
|
||||
if (start == part_start)
|
||||
{
|
||||
|
535
debian/patches/handle_new_autotools.patch
vendored
535
debian/patches/handle_new_autotools.patch
vendored
@ -1,535 +0,0 @@
|
||||
Description: Handle new autotools, and add some missing quotes in the process
|
||||
Backported by Colin Watson; I modified this to keep update-grub_lib in
|
||||
place until such time as we upgrade to a newer upstream snapshot.
|
||||
Author: Vladimir Serbinenko <phcoder@gmail.com>
|
||||
Origin: backport, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3766
|
||||
Last-Update: 2012-01-31
|
||||
|
||||
Index: b/Makefile.am
|
||||
===================================================================
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -101,8 +101,8 @@
|
||||
# Install config.h into platformdir
|
||||
platform_HEADERS = config.h
|
||||
|
||||
-pkglib_DATA += grub-mkconfig_lib
|
||||
-pkglib_DATA += update-grub_lib
|
||||
+pkgdata_DATA += grub-mkconfig_lib
|
||||
+pkgdata_DATA += update-grub_lib
|
||||
|
||||
|
||||
if COND_i386_coreboot
|
||||
Index: b/conf/Makefile.common
|
||||
===================================================================
|
||||
--- a/conf/Makefile.common
|
||||
+++ b/conf/Makefile.common
|
||||
@@ -137,7 +137,7 @@
|
||||
|
||||
man_MANS =
|
||||
noinst_DATA =
|
||||
-pkglib_DATA =
|
||||
+pkgdata_DATA =
|
||||
bin_SCRIPTS =
|
||||
sbin_SCRIPTS =
|
||||
bin_PROGRAMS =
|
||||
@@ -147,7 +147,6 @@
|
||||
grubconf_DATA =
|
||||
check_PROGRAMS =
|
||||
noinst_SCRIPTS =
|
||||
-pkglib_SCRIPTS =
|
||||
noinst_PROGRAMS =
|
||||
grubconf_SCRIPTS =
|
||||
noinst_LIBRARIES =
|
||||
Index: b/tests/util/grub-shell-tester.in
|
||||
===================================================================
|
||||
--- a/tests/util/grub-shell-tester.in
|
||||
+++ b/tests/util/grub-shell-tester.in
|
||||
@@ -19,18 +19,17 @@
|
||||
# Initialize some variables.
|
||||
transform="@program_transform_name@"
|
||||
|
||||
-prefix=@prefix@
|
||||
-exec_prefix=@exec_prefix@
|
||||
-bindir=@bindir@
|
||||
-libdir=@libdir@
|
||||
-builddir=@builddir@
|
||||
+prefix="@prefix@"
|
||||
+exec_prefix="@exec_prefix@"
|
||||
+datarootdir="@datarootdir@"
|
||||
+builddir="@builddir@"
|
||||
PACKAGE_NAME=@PACKAGE_NAME@
|
||||
PACKAGE_TARNAME=@PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
target_cpu=@target_cpu@
|
||||
|
||||
# Force build directory components
|
||||
-PATH=${builddir}:$PATH
|
||||
+PATH="${builddir}:$PATH"
|
||||
export PATH
|
||||
|
||||
# Usage: usage
|
||||
@@ -85,23 +84,23 @@
|
||||
if [ "x${source}" = x ] ; then
|
||||
tmpfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
while read REPLY; do
|
||||
- echo $REPLY >> ${tmpfile}
|
||||
+ echo $REPLY >> "${tmpfile}"
|
||||
done
|
||||
- source=${tmpfile}
|
||||
+ source="${tmpfile}"
|
||||
fi
|
||||
|
||||
outfile1=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
-@builddir@/grub-shell --qemu-opts="${qemuopts}" --modules=${modules} ${source} >${outfile1}
|
||||
+"@builddir@/grub-shell" --qemu-opts="${qemuopts}" --modules=${modules} "${source}" >"${outfile1}"
|
||||
|
||||
outfile2=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
-bash ${source} >${outfile2}
|
||||
+bash "${source}" >"${outfile2}"
|
||||
|
||||
-if ! diff -q ${outfile1} ${outfile2} >/dev/null
|
||||
+if ! diff -q "${outfile1}" "${outfile2}" >/dev/null
|
||||
then
|
||||
echo "${source}: GRUB and BASH outputs did not match (see diff -u ${outfile1} ${outfile2})"
|
||||
status=1
|
||||
else
|
||||
- rm -f ${outfile1} ${outfile2}
|
||||
+ rm -f "${outfile1}" "${outfile2}"
|
||||
fi
|
||||
|
||||
exit $status
|
||||
Index: b/tests/util/grub-shell.in
|
||||
===================================================================
|
||||
--- a/tests/util/grub-shell.in
|
||||
+++ b/tests/util/grub-shell.in
|
||||
@@ -19,11 +19,10 @@
|
||||
# Initialize some variables.
|
||||
transform="@program_transform_name@"
|
||||
|
||||
-prefix=@prefix@
|
||||
-exec_prefix=@exec_prefix@
|
||||
-bindir=@bindir@
|
||||
-libdir=@libdir@
|
||||
-builddir=@builddir@
|
||||
+prefix="@prefix@"
|
||||
+exec_prefix="@exec_prefix@"
|
||||
+datarootdir="@datarootdir@"
|
||||
+builddir="@builddir@"
|
||||
PACKAGE_NAME=@PACKAGE_NAME@
|
||||
PACKAGE_TARNAME=@PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
@@ -31,7 +30,7 @@
|
||||
platform=@platform@
|
||||
|
||||
# Force build directory components
|
||||
-PATH=${builddir}:$PATH
|
||||
+PATH="${builddir}:$PATH"
|
||||
export PATH
|
||||
|
||||
# Usage: usage
|
||||
@@ -140,9 +139,9 @@
|
||||
|
||||
isofile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
if [ x$boot != xnet ]; then
|
||||
- sh @builddir@/grub-mkrescue --grub-mkimage=${builddir}/grub-mkimage --output=${isofile} --override-directory=${builddir}/grub-core \
|
||||
+ sh "@builddir@/grub-mkrescue" "--grub-mkimage=${builddir}/grub-mkimage" "--output=${isofile}" "--override-directory=${builddir}/grub-core" \
|
||||
--rom-directory="${rom_directory}" \
|
||||
- /boot/grub/grub.cfg=${cfgfile} /boot/grub/testcase.cfg=${source} \
|
||||
+ "/boot/grub/grub.cfg=${cfgfile}" "/boot/grub/testcase.cfg=${source}" \
|
||||
${files} >/dev/null 2>&1
|
||||
fi
|
||||
if [ x$boot = xhd ]; then
|
||||
@@ -173,12 +172,12 @@
|
||||
|
||||
if [ x$boot = xnet ]; then
|
||||
netdir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
- sh @builddir@/grub-mknetdir --grub-mkimage=${builddir}/grub-mkimage --override-directory=${builddir}/grub-core --net-directory=$netdir
|
||||
- cp ${cfgfile} $netdir/boot/grub/grub.cfg
|
||||
- cp ${source} $netdir/boot/grub/testcase.cfg
|
||||
- ${qemu} ${qemuopts} -nographic -serial file:/dev/stdout -monitor file:/dev/null -boot n -net user,tftp=$netdir,bootfile=/boot/grub/$target_cpu-$platform/core.0 -net nic | cat | tr -d "\r"
|
||||
+ sh "@builddir@/grub-mknetdir" "--grub-mkimage=${builddir}/grub-mkimage" "--override-directory=${builddir}/grub-core" "--net-directory=$netdir"
|
||||
+ cp "${cfgfile}" "$netdir/boot/grub/grub.cfg"
|
||||
+ cp "${source}" "$netdir/boot/grub/testcase.cfg"
|
||||
+ "${qemu}" ${qemuopts} -nographic -serial file:/dev/stdout -monitor file:/dev/null -boot n -net "user,tftp=$netdir,bootfile=/boot/grub/$target_cpu-$platform/core.0" -net nic | cat | tr -d "\r"
|
||||
else
|
||||
- ${qemu} ${qemuopts} -nographic -serial file:/dev/stdout -monitor file:/dev/null -${device} ${isofile} ${bootdev} | cat | tr -d "\r"
|
||||
+ "${qemu}" ${qemuopts} -nographic -serial file:/dev/stdout -monitor file:/dev/null -${device} ${isofile} ${bootdev} | cat | tr -d "\r"
|
||||
fi
|
||||
rm -f "${isofile}" "${imgfile}"
|
||||
rm -rf "${rom_directory}"
|
||||
Index: b/util/grub-install.in
|
||||
===================================================================
|
||||
--- a/util/grub-install.in
|
||||
+++ b/util/grub-install.in
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
prefix="@prefix@"
|
||||
exec_prefix="@exec_prefix@"
|
||||
+datarootdir="@datarootdir@"
|
||||
sbindir="@sbindir@"
|
||||
bindir="@bindir@"
|
||||
libdir="@libdir@"
|
||||
@@ -32,6 +33,7 @@
|
||||
platform=@platform@
|
||||
host_os=@host_os@
|
||||
pkglibdir="${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`"
|
||||
+datadir="@datadir@"
|
||||
localedir="@datadir@/locale"
|
||||
|
||||
self="`basename $0`"
|
||||
Index: b/util/grub-mkconfig.in
|
||||
===================================================================
|
||||
--- a/util/grub-mkconfig.in
|
||||
+++ b/util/grub-mkconfig.in
|
||||
@@ -18,26 +18,27 @@
|
||||
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
transform="@program_transform_name@"
|
||||
-
|
||||
-prefix=@prefix@
|
||||
-exec_prefix=@exec_prefix@
|
||||
-sbindir=@sbindir@
|
||||
-bindir=@bindir@
|
||||
-libdir=@libdir@
|
||||
-sysconfdir=@sysconfdir@
|
||||
+prefix="@prefix@"
|
||||
+exec_prefix="@exec_prefix@"
|
||||
+datarootdir="@datarootdir@"
|
||||
+
|
||||
+prefix="@prefix@"
|
||||
+exec_prefix="@exec_prefix@"
|
||||
+sbindir="@sbindir@"
|
||||
+bindir="@bindir@"
|
||||
+sysconfdir="@sysconfdir@"
|
||||
PACKAGE_NAME=@PACKAGE_NAME@
|
||||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
host_os=@host_os@
|
||||
-datarootdir=@datarootdir@
|
||||
-datadir=@datadir@
|
||||
-pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`
|
||||
+datadir="@datadir@"
|
||||
+pkgdatadir="${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`"
|
||||
grub_cfg=""
|
||||
-grub_mkconfig_dir=${sysconfdir}/grub.d
|
||||
+grub_mkconfig_dir="${sysconfdir}"/grub.d
|
||||
|
||||
self=`basename $0`
|
||||
|
||||
-grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed "${transform}"`
|
||||
-grub_probe=${sbindir}/`echo grub-probe | sed "${transform}"`
|
||||
+grub_mkdevicemap="${sbindir}/`echo grub-mkdevicemap | sed "${transform}"`"
|
||||
+grub_probe="${sbindir}/`echo grub-probe | sed "${transform}"`"
|
||||
grub_script_check="${bindir}/`echo grub-script-check | sed "${transform}"`"
|
||||
|
||||
GRUB_PREFIX=`echo '/@bootdirname@/@grubdirname@' | sed "s,//*,/,g"`
|
||||
@@ -95,7 +96,7 @@
|
||||
esac
|
||||
done
|
||||
|
||||
-. ${libdir}/grub/grub-mkconfig_lib
|
||||
+. "${datadir}/grub/grub-mkconfig_lib"
|
||||
|
||||
if [ "x$EUID" = "x" ] ; then
|
||||
EUID=`id -u`
|
||||
Index: b/util/grub-mknetdir.in
|
||||
===================================================================
|
||||
--- a/util/grub-mknetdir.in
|
||||
+++ b/util/grub-mknetdir.in
|
||||
@@ -19,25 +19,23 @@
|
||||
# Initialize some variables.
|
||||
transform="@program_transform_name@"
|
||||
|
||||
-prefix=@prefix@
|
||||
-exec_prefix=@exec_prefix@
|
||||
-sbindir=@sbindir@
|
||||
-bindir=@bindir@
|
||||
-libdir=@libdir@
|
||||
+prefix="@prefix@"
|
||||
+exec_prefix="@exec_prefix@"
|
||||
+datarootdir="@datarootdir@"
|
||||
+bindir="@bindir@"
|
||||
+libdir="@libdir@"
|
||||
PACKAGE_NAME=@PACKAGE_NAME@
|
||||
PACKAGE_TARNAME=@PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
target_cpu=@target_cpu@
|
||||
platform=@platform@
|
||||
host_os=@host_os@
|
||||
-pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
|
||||
-localedir=@datadir@/locale
|
||||
native_platform=@platform@
|
||||
pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst"
|
||||
|
||||
self=`basename $0`
|
||||
|
||||
-grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
|
||||
+grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`"
|
||||
rootdir=/srv/tftp
|
||||
grub_prefix=`echo /boot/grub | sed ${transform}`
|
||||
modules=
|
||||
@@ -48,7 +46,7 @@
|
||||
debug=no
|
||||
debug_image=
|
||||
subdir=`echo /boot/grub | sed ${transform}`
|
||||
-pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-pc
|
||||
+pc_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-pc"
|
||||
|
||||
# Usage: usage
|
||||
# Print the usage.
|
||||
@@ -170,12 +168,12 @@
|
||||
config_opt=
|
||||
mkdir -p "$grubdir" || exit 1
|
||||
|
||||
- for file in ${grubdir}/*.mod ${grubdir}/*.lst ${grubdir}/*.img ${grubdir}/efiemu??.o; do
|
||||
- if test -f $file && [ "`basename $file`" != menu.lst ]; then
|
||||
- rm -f $file || exit 1
|
||||
+ for file in "${grubdir}"/*.mod "${grubdir}"/*.lst "${grubdir}"/*.img "${grubdir}"/efiemu??.o; do
|
||||
+ if test -f "$file" && [ "`basename $file`" != menu.lst ]; then
|
||||
+ rm -f "$file" || exit 1
|
||||
fi
|
||||
done
|
||||
- for file in ${input_dir}/*.mod; do
|
||||
+ for file in "${input_dir}"/*.mod; do
|
||||
if test -f "$file"; then
|
||||
cp -f "$file" "$grubdir/"
|
||||
fi
|
||||
@@ -213,7 +211,7 @@
|
||||
source ${subdir}/grub.cfg
|
||||
EOF
|
||||
|
||||
- $grub_mkimage ${config_opt} -d "${input_dir}" -O ${mkimage_target} --output=${grubdir}/core.$ext --prefix=$prefix $modules $netmodules || exit 1
|
||||
+ "$grub_mkimage" ${config_opt} -d "${input_dir}" -O ${mkimage_target} "--output=${grubdir}/core.$ext" "--prefix=$prefix" $modules $netmodules || exit 1
|
||||
echo "Netboot directory for ${platform} created. Configure your DHCP server to point to ${subdir}/${platform}/core.$ext"
|
||||
}
|
||||
|
||||
Index: b/util/grub-mkrescue.in
|
||||
===================================================================
|
||||
--- a/util/grub-mkrescue.in
|
||||
+++ b/util/grub-mkrescue.in
|
||||
@@ -18,12 +18,14 @@
|
||||
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Initialize some variables.
|
||||
+
|
||||
transform="@program_transform_name@"
|
||||
|
||||
-prefix=@prefix@
|
||||
-exec_prefix=@exec_prefix@
|
||||
-bindir=@bindir@
|
||||
-libdir=@libdir@
|
||||
+prefix="@prefix@"
|
||||
+exec_prefix="@exec_prefix@"
|
||||
+datarootdir="@datarootdir@"
|
||||
+bindir="@bindir@"
|
||||
+libdir="@libdir@"
|
||||
PACKAGE_NAME=@PACKAGE_NAME@
|
||||
PACKAGE_TARNAME=@PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
Index: b/util/grub.d/00_header.in
|
||||
===================================================================
|
||||
--- a/util/grub.d/00_header.in
|
||||
+++ b/util/grub.d/00_header.in
|
||||
@@ -19,13 +19,13 @@
|
||||
|
||||
transform="@program_transform_name@"
|
||||
|
||||
-prefix=@prefix@
|
||||
-exec_prefix=@exec_prefix@
|
||||
-libdir=@libdir@
|
||||
+prefix="@prefix@"
|
||||
+exec_prefix="@exec_prefix@"
|
||||
+datarootdir="@datarootdir@"
|
||||
locale_dir=`echo ${GRUB_PREFIX}/locale | sed ${transform}`
|
||||
grub_lang=`echo $LANG | cut -d . -f 1`
|
||||
|
||||
-. ${libdir}/grub/grub-mkconfig_lib
|
||||
+. "@datadir@/grub/grub-mkconfig_lib"
|
||||
|
||||
# Do this as early as possible, since other commands might depend on it.
|
||||
# (e.g. the `loadfont' command might need lvm or raid modules)
|
||||
@@ -112,7 +112,7 @@
|
||||
done
|
||||
|
||||
if [ "x$serial" = x1 ]; then
|
||||
- if ! test -e ${GRUB_PREFIX}/serial.mod ; then
|
||||
+ if ! test -e "${GRUB_PREFIX}/serial.mod" ; then
|
||||
echo "Serial terminal not available on this platform." >&2 ; exit 1
|
||||
fi
|
||||
|
||||
Index: b/util/grub.d/10_hurd.in
|
||||
===================================================================
|
||||
--- a/util/grub.d/10_hurd.in
|
||||
+++ b/util/grub.d/10_hurd.in
|
||||
@@ -17,10 +17,10 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-prefix=@prefix@
|
||||
-exec_prefix=@exec_prefix@
|
||||
-libdir=@libdir@
|
||||
-. ${libdir}/grub/grub-mkconfig_lib
|
||||
+prefix="@prefix@"
|
||||
+exec_prefix="@exec_prefix@"
|
||||
+datarootdir="@datarootdir@"
|
||||
+. "@datadir@/grub/grub-mkconfig_lib"
|
||||
|
||||
CLASS="--class gnu --class os"
|
||||
|
||||
Index: b/util/grub.d/10_kfreebsd.in
|
||||
===================================================================
|
||||
--- a/util/grub.d/10_kfreebsd.in
|
||||
+++ b/util/grub.d/10_kfreebsd.in
|
||||
@@ -17,14 +17,13 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-prefix=@prefix@
|
||||
-exec_prefix=@exec_prefix@
|
||||
-bindir=@bindir@
|
||||
-libdir=@libdir@
|
||||
-. ${libdir}/grub/grub-mkconfig_lib
|
||||
+prefix="@prefix@"
|
||||
+exec_prefix="@exec_prefix@"
|
||||
+datarootdir="@datarootdir@"
|
||||
+. "@datadir@/grub/grub-mkconfig_lib"
|
||||
|
||||
export TEXTDOMAIN=@PACKAGE@
|
||||
-export TEXTDOMAINDIR=@localedir@
|
||||
+export TEXTDOMAINDIR="@localedir@"
|
||||
|
||||
CLASS="--class os"
|
||||
|
||||
Index: b/util/grub.d/10_linux.in
|
||||
===================================================================
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -17,14 +17,14 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-prefix=@prefix@
|
||||
-exec_prefix=@exec_prefix@
|
||||
-bindir=@bindir@
|
||||
-libdir=@libdir@
|
||||
-. ${libdir}/grub/grub-mkconfig_lib
|
||||
+prefix="@prefix@"
|
||||
+exec_prefix="@exec_prefix@"
|
||||
+datarootdir="@datarootdir@"
|
||||
+
|
||||
+. "@datadir@/grub/grub-mkconfig_lib"
|
||||
|
||||
export TEXTDOMAIN=@PACKAGE@
|
||||
-export TEXTDOMAINDIR=@localedir@
|
||||
+export TEXTDOMAINDIR="@localedir@"
|
||||
|
||||
CLASS="--class gnu-linux --class gnu --class os"
|
||||
|
||||
Index: b/util/grub.d/10_netbsd.in
|
||||
===================================================================
|
||||
--- a/util/grub.d/10_netbsd.in
|
||||
+++ b/util/grub.d/10_netbsd.in
|
||||
@@ -17,14 +17,13 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-prefix=@prefix@
|
||||
-exec_prefix=@exec_prefix@
|
||||
-bindir=@bindir@
|
||||
-libdir=@libdir@
|
||||
-. ${libdir}/grub/grub-mkconfig_lib
|
||||
+prefix="@prefix@"
|
||||
+exec_prefix="@exec_prefix@"
|
||||
+datarootdir="@datarootdir@"
|
||||
+. "@datadir@/grub/grub-mkconfig_lib"
|
||||
|
||||
export TEXTDOMAIN=@PACKAGE@
|
||||
-export TEXTDOMAINDIR=@localedir@
|
||||
+export TEXTDOMAINDIR="@localedir@"
|
||||
|
||||
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
||||
OS="NetBSD"
|
||||
Index: b/util/grub.d/10_windows.in
|
||||
===================================================================
|
||||
--- a/util/grub.d/10_windows.in
|
||||
+++ b/util/grub.d/10_windows.in
|
||||
@@ -17,10 +17,11 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-prefix=@prefix@
|
||||
-exec_prefix=@exec_prefix@
|
||||
-libdir=@libdir@
|
||||
-. ${libdir}/grub/grub-mkconfig_lib
|
||||
+prefix="@prefix@"
|
||||
+exec_prefix="@exec_prefix@"
|
||||
+datarootdir="@datarootdir@"
|
||||
+
|
||||
+. "@datadir@/grub/grub-mkconfig_lib"
|
||||
|
||||
case "`uname 2>/dev/null`" in
|
||||
CYGWIN*) ;;
|
||||
Index: b/util/grub.d/20_linux_xen.in
|
||||
===================================================================
|
||||
--- a/util/grub.d/20_linux_xen.in
|
||||
+++ b/util/grub.d/20_linux_xen.in
|
||||
@@ -17,14 +17,14 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-prefix=@prefix@
|
||||
-exec_prefix=@exec_prefix@
|
||||
-bindir=@bindir@
|
||||
-libdir=@libdir@
|
||||
-. ${libdir}/grub/grub-mkconfig_lib
|
||||
+prefix="@prefix@"
|
||||
+exec_prefix="@exec_prefix@"
|
||||
+datarootdir="@datarootdir@"
|
||||
+
|
||||
+. "@datadir@/grub/grub-mkconfig_lib"
|
||||
|
||||
export TEXTDOMAIN=@PACKAGE@
|
||||
-export TEXTDOMAINDIR=@localedir@
|
||||
+export TEXTDOMAINDIR="@localedir@"
|
||||
|
||||
CLASS="--class gnu-linux --class gnu --class os --class xen"
|
||||
|
||||
Index: b/util/grub.d/30_os-prober.in
|
||||
===================================================================
|
||||
--- a/util/grub.d/30_os-prober.in
|
||||
+++ b/util/grub.d/30_os-prober.in
|
||||
@@ -17,11 +17,11 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-prefix=@prefix@
|
||||
-exec_prefix=@exec_prefix@
|
||||
-libdir=@libdir@
|
||||
+prefix="@prefix@"
|
||||
+exec_prefix="@exec_prefix@"
|
||||
+datarootdir="@datarootdir@"
|
||||
|
||||
-. ${libdir}/grub/grub-mkconfig_lib
|
||||
+. "@datadir@/grub/grub-mkconfig_lib"
|
||||
|
||||
if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
|
||||
exit 0
|
||||
Index: b/util/update-grub_lib.in
|
||||
===================================================================
|
||||
--- a/util/update-grub_lib.in
|
||||
+++ b/util/update-grub_lib.in
|
||||
@@ -14,10 +14,10 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-prefix=@prefix@
|
||||
-exec_prefix=@exec_prefix@
|
||||
-libdir=@libdir@
|
||||
+prefix="@prefix@"
|
||||
+exec_prefix="@exec_prefix@"
|
||||
+datarootdir="@datarootdir@"
|
||||
|
||||
-. ${libdir}/grub/grub-mkconfig_lib
|
||||
+. "@datadir@/grub/grub-mkconfig_lib"
|
||||
|
||||
grub_warn "update-grub_lib is deprecated, use grub-mkconfig_lib instead"
|
37
debian/patches/hurd.patch
vendored
37
debian/patches/hurd.patch
vendored
@ -1,37 +0,0 @@
|
||||
Description: Fix hurd build by disabling zfs code.
|
||||
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||
Origin: upstream, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/4237
|
||||
Forwarded: not-needed
|
||||
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/4237
|
||||
Last-Update: 2012-06-08
|
||||
|
||||
--- a/grub-core/kern/emu/getroot.c 2012-04-21 14:49:56 +0000
|
||||
+++ b/grub-core/kern/emu/getroot.c 2012-04-22 19:02:55 +0000
|
||||
@@ -241,6 +241,8 @@
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
||||
+#if !defined (__GNU__)
|
||||
+
|
||||
static char *
|
||||
find_device_from_pool (const char *poolname)
|
||||
{
|
||||
@@ -322,6 +323,8 @@
|
||||
return device;
|
||||
}
|
||||
|
||||
+#endif
|
||||
+
|
||||
#ifdef __MINGW32__
|
||||
|
||||
char *
|
||||
@@ -331,6 +331,8 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#elif defined (__GNU__)
|
||||
+
|
||||
#elif ! defined(__CYGWIN__)
|
||||
|
||||
char *
|
||||
|
@ -8,8 +8,8 @@ Index: b/util/grub-install.in
|
||||
===================================================================
|
||||
--- a/util/grub-install.in
|
||||
+++ b/util/grub-install.in
|
||||
@@ -660,6 +660,13 @@
|
||||
fi
|
||||
@@ -863,6 +863,13 @@
|
||||
echo 1>&2
|
||||
fi
|
||||
|
||||
+# If vestiges of GRUB Legacy still exist, tell the Debian packaging that
|
||||
@ -19,6 +19,6 @@ Index: b/util/grub-install.in
|
||||
+ touch /boot/grub/grub2-installed
|
||||
+fi
|
||||
+
|
||||
echo "Installation finished. No error reported."
|
||||
gettext "Installation finished. No error reported." 1>&2
|
||||
echo 1>&2
|
||||
|
||||
# Bye.
|
||||
|
71
debian/patches/kfreebsd-9_ada_devices.patch
vendored
71
debian/patches/kfreebsd-9_ada_devices.patch
vendored
@ -1,71 +0,0 @@
|
||||
2011-06-16 Robert Millan <rmh@gnu.org>
|
||||
|
||||
Detect `ataraid' devices on GNU/kFreeBSD. Fix for ATA devices using
|
||||
`ata' driver on kernel of FreeBSD 9.
|
||||
|
||||
* util/deviceiter.c [__FreeBSD_kernel__] (get_ada_disk_name)
|
||||
(get_ataraid_disk_name): New functions.
|
||||
[__FreeBSD_kernel__] (grub_util_iterate_devices): Scan for ataraid
|
||||
(/dev/ar[0-9]+) and ada (/dev/ada[0-9]+) devices using
|
||||
get_ataraid_disk_name() and get_ada_disk_name().
|
||||
|
||||
=== modified file 'util/deviceiter.c'
|
||||
--- a/util/deviceiter.c
|
||||
+++ b/util/deviceiter.c
|
||||
@@ -286,6 +286,20 @@
|
||||
#endif
|
||||
}
|
||||
|
||||
+#ifdef __FreeBSD_kernel__
|
||||
+static void
|
||||
+get_ada_disk_name (char *name, int unit)
|
||||
+{
|
||||
+ sprintf (name, "/dev/ada%d", unit);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+get_ataraid_disk_name (char *name, int unit)
|
||||
+{
|
||||
+ sprintf (name, "/dev/ar%d", unit);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#ifdef __linux__
|
||||
static void
|
||||
get_virtio_disk_name (char *name, int unit)
|
||||
@@ -620,6 +634,35 @@
|
||||
}
|
||||
}
|
||||
|
||||
+#ifdef __FreeBSD_kernel__
|
||||
+ /* IDE disks using ATA Direct Access driver. */
|
||||
+ if (get_kfreebsd_version () >= 800000)
|
||||
+ for (i = 0; i < 96; i++)
|
||||
+ {
|
||||
+ char name[16];
|
||||
+
|
||||
+ get_ada_disk_name (name, i);
|
||||
+ if (check_device_readable_unique (name))
|
||||
+ {
|
||||
+ if (hook (name, 0))
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* ATARAID disks. */
|
||||
+ for (i = 0; i < 8; i++)
|
||||
+ {
|
||||
+ char name[20];
|
||||
+
|
||||
+ get_ataraid_disk_name (name, i);
|
||||
+ if (check_device_readable_unique (name))
|
||||
+ {
|
||||
+ if (hook (name, 0))
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
#ifdef __linux__
|
||||
/* Virtio disks. */
|
||||
for (i = 0; i < 26; i++)
|
187
debian/patches/kfreebsd_lvm.patch
vendored
187
debian/patches/kfreebsd_lvm.patch
vendored
@ -1,187 +0,0 @@
|
||||
2011-10-09 Robert Millan <rmh@gnu.org>
|
||||
|
||||
LVM support for FreeBSD and GNU/kFreeBSD.
|
||||
|
||||
* util/lvm.c (grub_util_lvm_isvolume): Enable on FreeBSD and
|
||||
GNU/kFreeBSD.
|
||||
(LVM_DEV_MAPPER_STRING): Move from here ...
|
||||
* include/grub/util/lvm.h (LVM_DEV_MAPPER_STRING): ... to here.
|
||||
* util/getroot.c: Include `<grub/util/lvm.h>'.
|
||||
(grub_util_get_dev_abstraction): Enable
|
||||
grub_util_biosdisk_is_present() on FreeBSD and GNU/kFreeBSD.
|
||||
Check for LVM abstraction on FreeBSD and GNU/kFreeBSD.
|
||||
(grub_util_get_grub_dev): Replace "/dev/mapper/" with
|
||||
`LVM_DEV_MAPPER_STRING'. Enable LVM and mdRAID only on platforms that
|
||||
support it.
|
||||
* util/grub-setup.c (main): Check for LVM also on FreeBSD and
|
||||
GNU/kFreeBSD.
|
||||
* util/grub.d/10_kfreebsd.in: Load `geom_linux_lvm' kernel module
|
||||
when LVM abstraction is required for ${GRUB_DEVICE}.
|
||||
|
||||
--- a/grub-core/kern/emu/getroot.c
|
||||
+++ b/grub-core/kern/emu/getroot.c
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <grub/util/misc.h>
|
||||
+#include <grub/util/lvm.h>
|
||||
|
||||
#ifdef HAVE_DEVICE_MAPPER
|
||||
# include <libdevmapper.h>
|
||||
@@ -709,11 +710,13 @@
|
||||
int
|
||||
grub_util_get_dev_abstraction (const char *os_dev __attribute__((unused)))
|
||||
{
|
||||
-#ifdef __linux__
|
||||
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
/* User explicitly claims that this drive is visible by BIOS. */
|
||||
if (grub_util_biosdisk_is_present (os_dev))
|
||||
return GRUB_DEV_ABSTRACTION_NONE;
|
||||
+#endif
|
||||
|
||||
+#if defined(__linux__)
|
||||
/* Check for LVM. */
|
||||
if (grub_util_is_lvm (os_dev))
|
||||
return GRUB_DEV_ABSTRACTION_LVM;
|
||||
@@ -723,6 +726,12 @@
|
||||
return GRUB_DEV_ABSTRACTION_RAID;
|
||||
#endif
|
||||
|
||||
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+ /* Check for LVM. */
|
||||
+ if (!strncmp (os_dev, LVM_DEV_MAPPER_STRING, sizeof(LVM_DEV_MAPPER_STRING)-1))
|
||||
+ return GRUB_DEV_ABSTRACTION_LVM;
|
||||
+#endif
|
||||
+
|
||||
/* No abstraction found. */
|
||||
return GRUB_DEV_ABSTRACTION_NONE;
|
||||
}
|
||||
@@ -815,11 +824,12 @@
|
||||
|
||||
switch (grub_util_get_dev_abstraction (os_dev))
|
||||
{
|
||||
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
case GRUB_DEV_ABSTRACTION_LVM:
|
||||
|
||||
{
|
||||
unsigned short i, len;
|
||||
- grub_size_t offset = sizeof ("/dev/mapper/") - 1;
|
||||
+ grub_size_t offset = sizeof (LVM_DEV_MAPPER_STRING) - 1;
|
||||
|
||||
len = strlen (os_dev) - offset + 1;
|
||||
grub_dev = xmalloc (len);
|
||||
@@ -833,7 +843,9 @@
|
||||
}
|
||||
|
||||
break;
|
||||
+#endif
|
||||
|
||||
+#ifdef __linux__
|
||||
case GRUB_DEV_ABSTRACTION_RAID:
|
||||
|
||||
if (os_dev[7] == '_' && os_dev[8] == 'd')
|
||||
@@ -909,7 +921,6 @@
|
||||
else
|
||||
grub_util_error ("unknown kind of RAID device `%s'", os_dev);
|
||||
|
||||
-#ifdef __linux__
|
||||
{
|
||||
char *mdadm_name = get_mdadm_uuid (os_dev);
|
||||
struct stat st;
|
||||
@@ -934,9 +945,8 @@
|
||||
free (mdadm_name);
|
||||
}
|
||||
}
|
||||
-#endif /* __linux__ */
|
||||
-
|
||||
break;
|
||||
+#endif /* __linux__ */
|
||||
|
||||
default: /* GRUB_DEV_ABSTRACTION_NONE */
|
||||
grub_dev = grub_util_biosdisk_get_grub_dev (os_dev);
|
||||
--- a/include/grub/util/lvm.h
|
||||
+++ b/include/grub/util/lvm.h
|
||||
@@ -20,7 +20,14 @@
|
||||
#ifndef GRUB_LVM_UTIL_HEADER
|
||||
#define GRUB_LVM_UTIL_HEADER 1
|
||||
|
||||
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
+
|
||||
#ifdef __linux__
|
||||
+#define LVM_DEV_MAPPER_STRING "/dev/mapper/"
|
||||
+#else
|
||||
+#define LVM_DEV_MAPPER_STRING "/dev/linux_lvm/"
|
||||
+#endif
|
||||
+
|
||||
int grub_util_lvm_isvolume (char *name);
|
||||
#endif
|
||||
|
||||
--- a/util/grub-setup.c
|
||||
+++ b/util/grub-setup.c
|
||||
@@ -959,10 +959,12 @@
|
||||
arguments.dir ? : DEFAULT_DIRECTORY);
|
||||
}
|
||||
|
||||
-#ifdef __linux__
|
||||
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
if (grub_util_lvm_isvolume (root_dev))
|
||||
must_embed = 1;
|
||||
+#endif
|
||||
|
||||
+#ifdef __linux__
|
||||
if (root_dev[0] == 'm' && root_dev[1] == 'd'
|
||||
&& ((root_dev[2] >= '0' && root_dev[2] <= '9') || root_dev[2] == '/'))
|
||||
{
|
||||
--- a/util/grub.d/10_kfreebsd.in
|
||||
+++ b/util/grub.d/10_kfreebsd.in
|
||||
@@ -98,6 +98,23 @@
|
||||
|
||||
load_kfreebsd_module acpi true
|
||||
|
||||
+ for abstraction in dummy $(grub-probe -t abstraction --device ${GRUB_DEVICE}) ; do
|
||||
+ case $abstraction in
|
||||
+ lvm) load_kfreebsd_module geom_linux_lvm false ;;
|
||||
+ esac
|
||||
+ done
|
||||
+
|
||||
+ case "$(grub-probe -t abstraction --device ${GRUB_DEVICE})" in
|
||||
+ lvm)
|
||||
+ test -e "${module_dir}/geom_linux_lvm.ko"
|
||||
+
|
||||
+ printf '%s\n' "${prepare_module_dir_cache}"
|
||||
+ cat << EOF
|
||||
+ kfreebsd_module_elf ${module_dir_rel}/geom_linux_lvm.ko
|
||||
+EOF
|
||||
+ ;;
|
||||
+ esac
|
||||
+
|
||||
case "${kfreebsd_fs}" in
|
||||
zfs)
|
||||
load_kfreebsd_module opensolaris false
|
||||
--- a/util/lvm.c
|
||||
+++ b/util/lvm.c
|
||||
@@ -17,8 +17,7 @@
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
-/* We only support LVM on Linux. */
|
||||
-#ifdef __linux__
|
||||
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#include <grub/emu/misc.h>
|
||||
#include <grub/util/misc.h>
|
||||
#include <grub/util/lvm.h>
|
||||
@@ -26,8 +25,6 @@
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
-#define LVM_DEV_MAPPER_STRING "/dev/mapper/"
|
||||
-
|
||||
int
|
||||
grub_util_lvm_isvolume (char *name)
|
||||
{
|
||||
@@ -49,4 +46,4 @@
|
||||
return 1;
|
||||
}
|
||||
|
||||
-#endif /* ! __linux__ */
|
||||
+#endif
|
35
debian/patches/kfreebsd_mfi_devices.patch
vendored
35
debian/patches/kfreebsd_mfi_devices.patch
vendored
@ -1,35 +0,0 @@
|
||||
--- a/util/deviceiter.c
|
||||
+++ b/util/deviceiter.c
|
||||
@@ -298,6 +298,12 @@
|
||||
{
|
||||
sprintf (name, "/dev/ar%d", unit);
|
||||
}
|
||||
+
|
||||
+static void
|
||||
+get_mfi_disk_name (char *name, int unit)
|
||||
+{
|
||||
+ sprintf (name, "/dev/mfid%d", unit);
|
||||
+}
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
@@ -658,6 +664,19 @@
|
||||
if (check_device_readable_unique (name))
|
||||
{
|
||||
if (hook (name, 0))
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /* LSI MegaRAID SAS. */
|
||||
+ for (i = 0; i < 32; i++)
|
||||
+ {
|
||||
+ char name[20];
|
||||
+
|
||||
+ get_mfi_disk_name (name, i);
|
||||
+ if (check_device_readable_unique (name))
|
||||
+ {
|
||||
+ if (hook (name, 0))
|
||||
goto out;
|
||||
}
|
||||
}
|
73
debian/patches/lazy_stat.patch
vendored
73
debian/patches/lazy_stat.patch
vendored
@ -1,73 +0,0 @@
|
||||
Description: Don't stat devices unless we have to
|
||||
Author: Vladimir Serbinenko <phcoder@gmail.com>
|
||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||
Bug-Debian: http://bugs.debian.org/627587
|
||||
Forwarded: yes
|
||||
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3318
|
||||
Last-Update: 2011-05-31
|
||||
|
||||
Index: b/grub-core/kern/emu/getroot.c
|
||||
===================================================================
|
||||
--- a/grub-core/kern/emu/getroot.c
|
||||
+++ b/grub-core/kern/emu/getroot.c
|
||||
@@ -358,7 +358,7 @@
|
||||
|
||||
if (S_ISLNK (st.st_mode)) {
|
||||
#ifdef __linux__
|
||||
- if (strcmp (dir, "mapper") == 0) {
|
||||
+ if (strcmp (dir, "mapper") == 0 || strcmp (dir, "/dev/mapper") == 0) {
|
||||
/* Follow symbolic links under /dev/mapper/; the canonical name
|
||||
may be something like /dev/dm-0, but the names under
|
||||
/dev/mapper/ are more human-readable and so we prefer them if
|
||||
@@ -609,20 +609,27 @@
|
||||
|
||||
if (os_dev)
|
||||
{
|
||||
- if (stat (os_dev, &st) >= 0)
|
||||
- dev = st.st_rdev;
|
||||
- else
|
||||
- grub_util_error ("cannot stat `%s'", os_dev);
|
||||
- free (os_dev);
|
||||
+ char *tmp = os_dev;
|
||||
+ os_dev = canonicalize_file_name (os_dev);
|
||||
+ free (tmp);
|
||||
}
|
||||
- else
|
||||
+
|
||||
+ if (os_dev)
|
||||
{
|
||||
- if (stat (dir, &st) >= 0)
|
||||
- dev = st.st_dev;
|
||||
- else
|
||||
- grub_util_error ("cannot stat `%s'", dir);
|
||||
+ if (strncmp (os_dev, "/dev/dm-", sizeof ("/dev/dm-") - 1) != 0)
|
||||
+ return os_dev;
|
||||
+ if (stat (os_dev, &st) < 0)
|
||||
+ grub_util_error ("cannot stat `%s'", os_dev);
|
||||
+ free (os_dev);
|
||||
+ dev = st.st_rdev;
|
||||
+ return grub_find_device ("/dev/mapper", dev);
|
||||
}
|
||||
|
||||
+ if (stat (dir, &st) < 0)
|
||||
+ grub_util_error ("cannot stat `%s'", dir);
|
||||
+
|
||||
+ dev = st.st_dev;
|
||||
+
|
||||
#ifdef __CYGWIN__
|
||||
/* Cygwin specific function. */
|
||||
os_dev = grub_find_device (dir, dev);
|
||||
Index: b/grub-core/kern/emu/hostdisk.c
|
||||
===================================================================
|
||||
--- a/grub-core/kern/emu/hostdisk.c
|
||||
+++ b/grub-core/kern/emu/hostdisk.c
|
||||
@@ -1420,7 +1420,8 @@
|
||||
if (tree)
|
||||
dm_tree_free (tree);
|
||||
free (path);
|
||||
- char *ret = grub_find_device (NULL, (major << 8) | minor);
|
||||
+ char *ret = grub_find_device ("/dev/mapper",
|
||||
+ (major << 8) | minor);
|
||||
return ret;
|
||||
}
|
||||
|
8643
debian/patches/lzo.patch
vendored
8643
debian/patches/lzo.patch
vendored
File diff suppressed because it is too large
Load Diff
53
debian/patches/mkconfig_gnumach.patch
vendored
53
debian/patches/mkconfig_gnumach.patch
vendored
@ -1,53 +0,0 @@
|
||||
Description: Add support for GRUB_CMDLINE_GNUMACH
|
||||
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||
Origin: upstream, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3942
|
||||
Last-Update: 2012-03-05
|
||||
|
||||
Index: b/docs/grub.texi
|
||||
===================================================================
|
||||
--- a/docs/grub.texi
|
||||
+++ b/docs/grub.texi
|
||||
@@ -1167,6 +1167,9 @@
|
||||
As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, but for
|
||||
NetBSD.
|
||||
|
||||
+@item GRUB_CMDLINE_GNUMACH
|
||||
+As @samp{GRUB_CMDLINE_LINUX}, but for GNU Mach.
|
||||
+
|
||||
@item GRUB_CMDLINE_XEN
|
||||
@itemx GRUB_CMDLINE_XEN_DEFAULT
|
||||
The values of these options are appended to the values of
|
||||
Index: b/util/grub-mkconfig.in
|
||||
===================================================================
|
||||
--- a/util/grub-mkconfig.in
|
||||
+++ b/util/grub-mkconfig.in
|
||||
@@ -244,6 +244,7 @@
|
||||
GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT \
|
||||
GRUB_CMDLINE_NETBSD \
|
||||
GRUB_CMDLINE_NETBSD_DEFAULT \
|
||||
+ GRUB_CMDLINE_GNUMACH \
|
||||
GRUB_TERMINAL_INPUT \
|
||||
GRUB_TERMINAL_OUTPUT \
|
||||
GRUB_SERIAL_COMMAND \
|
||||
Index: b/util/grub.d/10_hurd.in
|
||||
===================================================================
|
||||
--- a/util/grub.d/10_hurd.in
|
||||
+++ b/util/grub.d/10_hurd.in
|
||||
@@ -84,7 +84,7 @@
|
||||
message="$(gettext_printf "Loading GNU Mach ...")"
|
||||
cat << EOF
|
||||
echo '$message'
|
||||
- multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/}
|
||||
+ multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/} ${GRUB_CMDLINE_GNUMACH}
|
||||
EOF
|
||||
save_default_entry | sed -e "s/^/\t/"
|
||||
prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
|
||||
@@ -108,7 +108,7 @@
|
||||
message="$(gettext_printf "Loading GNU Mach ...")"
|
||||
cat << EOF
|
||||
echo '$message'
|
||||
- multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/} -s
|
||||
+ multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/} -s ${GRUB_CMDLINE_GNUMACH}
|
||||
EOF
|
||||
prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
|
||||
message="$(gettext_printf "Loading the Hurd ...")"
|
14
debian/patches/mkconfig_loopback.patch
vendored
14
debian/patches/mkconfig_loopback.patch
vendored
@ -13,9 +13,9 @@ Index: b/util/grub-mkconfig_lib.in
|
||||
===================================================================
|
||||
--- a/util/grub-mkconfig_lib.in
|
||||
+++ b/util/grub-mkconfig_lib.in
|
||||
@@ -105,6 +105,21 @@
|
||||
{
|
||||
device="$1"
|
||||
@@ -129,6 +129,21 @@
|
||||
esac
|
||||
done
|
||||
|
||||
+ loop_file=
|
||||
+ case ${device} in
|
||||
@ -35,9 +35,9 @@ Index: b/util/grub-mkconfig_lib.in
|
||||
if dmsetup status $device 2>/dev/null | grep -q 'crypt[[:space:]]$'; then
|
||||
grub_warn \
|
||||
"$device is a crypto device, which GRUB cannot read directly. Some" \
|
||||
@@ -141,6 +156,14 @@
|
||||
if fs_uuid="`"${grub_probe}" --device "${device}" --target=fs_uuid 2> /dev/null`" ; then
|
||||
echo "search --no-floppy --fs-uuid --set=root ${fs_uuid}"
|
||||
@@ -169,6 +184,14 @@
|
||||
echo " search --no-floppy --fs-uuid --set=root ${fs_uuid}"
|
||||
echo "fi"
|
||||
fi
|
||||
+
|
||||
+ if [ "x${loop_file}" != x ]; then
|
||||
@ -49,7 +49,7 @@ Index: b/util/grub-mkconfig_lib.in
|
||||
+ fi
|
||||
}
|
||||
|
||||
grub_file_is_not_garbage ()
|
||||
grub_get_device_id ()
|
||||
Index: b/util/grub.d/10_linux.in
|
||||
===================================================================
|
||||
--- a/util/grub.d/10_linux.in
|
||||
|
6
debian/patches/mkconfig_skip_dmcrypt.patch
vendored
6
debian/patches/mkconfig_skip_dmcrypt.patch
vendored
@ -12,9 +12,9 @@ Index: b/util/grub-mkconfig_lib.in
|
||||
===================================================================
|
||||
--- a/util/grub-mkconfig_lib.in
|
||||
+++ b/util/grub-mkconfig_lib.in
|
||||
@@ -105,6 +105,15 @@
|
||||
{
|
||||
device="$1"
|
||||
@@ -129,6 +129,15 @@
|
||||
esac
|
||||
done
|
||||
|
||||
+ if dmsetup status $device 2>/dev/null | grep -q 'crypt[[:space:]]$'; then
|
||||
+ grub_warn \
|
||||
|
20
debian/patches/mkconfig_skip_readme.patch
vendored
20
debian/patches/mkconfig_skip_readme.patch
vendored
@ -1,20 +0,0 @@
|
||||
Description: Skip */README* as well as README*
|
||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||
Bug-Ubuntu: https://bugs.launchpad.net/bugs/537123
|
||||
Forwarded: yes
|
||||
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3422
|
||||
Last-Update: 2011-09-05
|
||||
|
||||
Index: b/util/grub-mkconfig_lib.in
|
||||
===================================================================
|
||||
--- a/util/grub-mkconfig_lib.in
|
||||
+++ b/util/grub-mkconfig_lib.in
|
||||
@@ -171,7 +171,7 @@
|
||||
if test -f "$1" ; then
|
||||
case "$1" in
|
||||
*.dpkg-*) return 1 ;; # debian dpkg
|
||||
- README*) return 1 ;; # documentation
|
||||
+ README*|*/README*) return 1 ;; # documentation
|
||||
esac
|
||||
else
|
||||
return 1
|
40
debian/patches/mkrescue_diet.patch
vendored
40
debian/patches/mkrescue_diet.patch
vendored
@ -10,25 +10,25 @@ Index: b/util/grub-mkrescue.in
|
||||
===================================================================
|
||||
--- a/util/grub-mkrescue.in
|
||||
+++ b/util/grub-mkrescue.in
|
||||
@@ -44,6 +44,7 @@
|
||||
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
|
||||
@@ -52,6 +52,7 @@
|
||||
grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`"
|
||||
|
||||
xorriso=xorriso
|
||||
+diet=no
|
||||
|
||||
# Usage: usage
|
||||
# Print the usage.
|
||||
@@ -59,6 +60,7 @@
|
||||
--rom-directory=DIR save rom images in DIR [optional]
|
||||
--xorriso=FILE use FILE as xorriso [optional]
|
||||
--grub-mkimage=FILE use FILE as grub-mkimage
|
||||
+ --diet apply size reducing measures [optional]
|
||||
|
||||
$self generates a bootable rescue image with specified source files, source
|
||||
directories, or mkisofs options listed by: xorriso -as mkisofs -help
|
||||
@@ -133,6 +135,9 @@
|
||||
export TEXTDOMAIN=@PACKAGE@
|
||||
export TEXTDOMAINDIR="@localedir@"
|
||||
@@ -76,6 +77,7 @@
|
||||
# TRANSLATORS: xorriso is a program for creating ISOs and burning CDs
|
||||
print_option_help "--xorriso=$filetrans" "$(gettext "use FILE as xorriso [optional]")"
|
||||
print_option_help "--grub-mkimage=$filetrans" "$(gettext "use FILE as grub-mkimage")"
|
||||
+ print_option_help "--diet" "$(gettext "apply size reducing measures [optional]")"
|
||||
echo
|
||||
gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "xorriso -as mkisofs -help" "$self" | grub_fmt
|
||||
echo
|
||||
@@ -148,6 +150,9 @@
|
||||
--xorriso=*)
|
||||
xorriso=`echo "${option}/" | sed 's/--xorriso=//'` ;;
|
||||
xorriso=`echo "${option}" | sed 's/--xorriso=//'` ;;
|
||||
|
||||
+ --diet)
|
||||
+ diet=yes ;;
|
||||
@ -36,19 +36,19 @@ Index: b/util/grub-mkrescue.in
|
||||
*)
|
||||
source="${source} ${option} $@"; break ;;
|
||||
esac
|
||||
@@ -307,7 +312,14 @@
|
||||
@@ -368,7 +373,14 @@
|
||||
fi
|
||||
|
||||
# build iso image
|
||||
-"${xorriso}" -as mkisofs -graft-points ${grub_mkisofs_arguments} --protective-msdos-label -o ${output_image} -r ${iso9660_dir} --sort-weight 0 / --sort-weight 1 /boot ${source}
|
||||
-"${xorriso}" -as mkisofs -graft-points ${grub_mkisofs_arguments} --protective-msdos-label -o "${output_image}" -r "${iso9660_dir}" --sort-weight 0 / --sort-weight 1 /boot ${source}
|
||||
+if [ "${diet}" = yes ]; then
|
||||
+ if [ -e "${output_image}" ]; then
|
||||
+ rm "${output_image}" || exit 1
|
||||
+ fi
|
||||
+ "${xorriso}" -report_about HINT -as mkisofs -graft-points -no-pad ${grub_mkisofs_arguments} --protective-msdos-label -r ${iso9660_dir} --sort-weight 0 / --sort-weight 1 /boot ${source} | cat >"${output_image}"
|
||||
+ "${xorriso}" -report_about HINT -as mkisofs -graft-points -no-pad ${grub_mkisofs_arguments} --protective-msdos-label -r "${iso9660_dir}" --sort-weight 0 / --sort-weight 1 /boot ${source} | cat >"${output_image}"
|
||||
+else
|
||||
+ "${xorriso}" -report_about HINT -as mkisofs -graft-points ${grub_mkisofs_arguments} --protective-msdos-label -o ${output_image} -r ${iso9660_dir} --sort-weight 0 / --sort-weight 1 /boot ${source}
|
||||
+ "${xorriso}" -report_about HINT -as mkisofs -graft-points ${grub_mkisofs_arguments} --protective-msdos-label -o "${output_image}" -r "${iso9660_dir}" --sort-weight 0 / --sort-weight 1 /boot ${source}
|
||||
+fi
|
||||
rm -rf ${iso9660_dir}
|
||||
rm -rf "${iso9660_dir}"
|
||||
|
||||
rm -f ${embed_img}
|
||||
rm -f "${embed_img}"
|
||||
|
6
debian/patches/mkrescue_efi_modules.patch
vendored
6
debian/patches/mkrescue_efi_modules.patch
vendored
@ -8,9 +8,9 @@ Index: b/util/grub-mkrescue.in
|
||||
===================================================================
|
||||
--- a/util/grub-mkrescue.in
|
||||
+++ b/util/grub-mkrescue.in
|
||||
@@ -288,9 +288,9 @@
|
||||
mkdir -p "${efi_dir}/efi/boot"
|
||||
|
||||
@@ -326,9 +326,9 @@
|
||||
# build bootia64.efi
|
||||
make_image "${ia64_dir}" ia64-efi "${efi_dir}"/efi/boot/bootia64.efi ""
|
||||
# build bootx64.efi
|
||||
- make_image "${efi64_dir}" x86_64-efi "${efi_dir}"/efi/boot/bootx64.efi ""
|
||||
+ make_image "${efi64_dir}" x86_64-efi "${efi_dir}"/efi/boot/bootx64.efi "part_msdos fat"
|
||||
|
227
debian/patches/no_libzfs.patch
vendored
227
debian/patches/no_libzfs.patch
vendored
@ -1,227 +0,0 @@
|
||||
--- a/grub-core/kern/emu/getroot.c
|
||||
+++ b/grub-core/kern/emu/getroot.c
|
||||
@@ -32,6 +32,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
+#ifdef HAVE_LIMITS_H
|
||||
+#include <limits.h>
|
||||
+#endif
|
||||
#include <grub/util/misc.h>
|
||||
#include <grub/util/lvm.h>
|
||||
|
||||
@@ -238,7 +241,67 @@
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
||||
-#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
|
||||
+static char *
|
||||
+find_device_from_pool (const char *poolname)
|
||||
+{
|
||||
+ char *device;
|
||||
+ char *cmd;
|
||||
+ FILE *fp;
|
||||
+ int ret;
|
||||
+ char *line;
|
||||
+ size_t len;
|
||||
+ int st;
|
||||
+
|
||||
+ char name[PATH_MAX], state[256], readlen[256], writelen[256], cksum[256], notes[256];
|
||||
+ unsigned int dummy;
|
||||
+
|
||||
+ cmd = xasprintf ("zpool status %s", poolname);
|
||||
+ fp = popen (cmd, "r");
|
||||
+ free (cmd);
|
||||
+
|
||||
+ st = 0;
|
||||
+ while (st < 3)
|
||||
+ {
|
||||
+ line = NULL;
|
||||
+ ret = getline (&line, &len, fp);
|
||||
+ if (ret == -1)
|
||||
+ {
|
||||
+ pclose (fp);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (sscanf (line, " %s %s %s %s %s %s", name, state, readlen, writelen, cksum, notes) >= 5)
|
||||
+ switch (st)
|
||||
+ {
|
||||
+ case 0:
|
||||
+ if (!strcmp (name, "NAME")
|
||||
+ && !strcmp (state, "STATE")
|
||||
+ && !strcmp (readlen, "READ")
|
||||
+ && !strcmp (writelen, "WRITE")
|
||||
+ && !strcmp (cksum, "CKSUM"))
|
||||
+ st++;
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ if (!strcmp (name, poolname))
|
||||
+ st++;
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ if (strcmp (name, "mirror") && !sscanf (name, "mirror-%u", &dummy)
|
||||
+ && !sscanf (name, "raidz%u", &dummy)
|
||||
+ && !strcmp (state, "ONLINE"))
|
||||
+ st++;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ free (line);
|
||||
+ }
|
||||
+ pclose (fp);
|
||||
+
|
||||
+ device = xasprintf ("/dev/%s", name);
|
||||
+
|
||||
+ return device;
|
||||
+}
|
||||
+
|
||||
static char *
|
||||
find_root_device_from_libzfs (const char *dir)
|
||||
{
|
||||
@@ -250,49 +313,7 @@
|
||||
if (! poolname)
|
||||
return NULL;
|
||||
|
||||
- {
|
||||
- zpool_handle_t *zpool;
|
||||
- libzfs_handle_t *libzfs;
|
||||
- nvlist_t *config, *vdev_tree;
|
||||
- nvlist_t **children, **path;
|
||||
- unsigned int nvlist_count;
|
||||
- unsigned int i;
|
||||
-
|
||||
- libzfs = grub_get_libzfs_handle ();
|
||||
- if (! libzfs)
|
||||
- return NULL;
|
||||
-
|
||||
- zpool = zpool_open (libzfs, poolname);
|
||||
- config = zpool_get_config (zpool, NULL);
|
||||
-
|
||||
- if (nvlist_lookup_nvlist (config, "vdev_tree", &vdev_tree) != 0)
|
||||
- error (1, errno, "nvlist_lookup_nvlist (\"vdev_tree\")");
|
||||
-
|
||||
- if (nvlist_lookup_nvlist_array (vdev_tree, "children", &children, &nvlist_count) != 0)
|
||||
- error (1, errno, "nvlist_lookup_nvlist_array (\"children\")");
|
||||
- assert (nvlist_count > 0);
|
||||
-
|
||||
- while (nvlist_lookup_nvlist_array (children[0], "children",
|
||||
- &children, &nvlist_count) == 0)
|
||||
- assert (nvlist_count > 0);
|
||||
-
|
||||
- for (i = 0; i < nvlist_count; i++)
|
||||
- {
|
||||
- if (nvlist_lookup_string (children[i], "path", &device) != 0)
|
||||
- error (1, errno, "nvlist_lookup_string (\"path\")");
|
||||
-
|
||||
- struct stat st;
|
||||
- if (stat (device, &st) == 0)
|
||||
- {
|
||||
- device = xstrdup (device);
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- device = NULL;
|
||||
- }
|
||||
-
|
||||
- zpool_close (zpool);
|
||||
- }
|
||||
+ device = find_device_from_pool (poolname);
|
||||
|
||||
free (poolname);
|
||||
if (poolfs)
|
||||
@@ -300,7 +321,6 @@
|
||||
|
||||
return device;
|
||||
}
|
||||
-#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
|
||||
@@ -603,10 +623,8 @@
|
||||
os_dev = grub_find_root_device_from_mountinfo (dir, NULL);
|
||||
#endif /* __linux__ */
|
||||
|
||||
-#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
|
||||
if (!os_dev)
|
||||
os_dev = find_root_device_from_libzfs (dir);
|
||||
-#endif
|
||||
|
||||
if (os_dev)
|
||||
{
|
||||
@@ -708,7 +726,7 @@
|
||||
}
|
||||
|
||||
int
|
||||
-grub_util_get_dev_abstraction (const char *os_dev __attribute__((unused)))
|
||||
+grub_util_get_dev_abstraction (const char *os_dev)
|
||||
{
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
/* User explicitly claims that this drive is visible by BIOS. */
|
||||
--- a/grub-core/kern/emu/misc.c
|
||||
+++ b/grub-core/kern/emu/misc.c
|
||||
@@ -287,7 +287,6 @@
|
||||
}
|
||||
#endif /* HAVE_LIBZFS */
|
||||
|
||||
-#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
|
||||
/* ZFS has similar problems to those of btrfs (see above). */
|
||||
void
|
||||
grub_find_zpool_from_dir (const char *dir, char **poolname, char **poolfs)
|
||||
@@ -348,7 +347,6 @@
|
||||
else
|
||||
*poolfs = xstrdup ("");
|
||||
}
|
||||
-#endif
|
||||
|
||||
/* This function never prints trailing slashes (so that its output
|
||||
can be appended a slash unconditionally). */
|
||||
@@ -361,22 +359,18 @@
|
||||
dev_t num;
|
||||
size_t len;
|
||||
|
||||
-#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
|
||||
char *poolfs = NULL;
|
||||
-#endif
|
||||
|
||||
/* canonicalize. */
|
||||
p = canonicalize_file_name (path);
|
||||
if (p == NULL)
|
||||
grub_util_error ("failed to get canonical path of %s", path);
|
||||
|
||||
-#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
|
||||
/* For ZFS sub-pool filesystems, could be extended to others (btrfs?). */
|
||||
{
|
||||
char *dummy;
|
||||
grub_find_zpool_from_dir (p, &dummy, &poolfs);
|
||||
}
|
||||
-#endif
|
||||
|
||||
len = strlen (p) + 1;
|
||||
buf = xstrdup (p);
|
||||
@@ -428,10 +422,8 @@
|
||||
}
|
||||
#endif
|
||||
free (buf2);
|
||||
-#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
|
||||
if (poolfs)
|
||||
return xasprintf ("/%s/@", poolfs);
|
||||
-#endif
|
||||
return xstrdup ("");
|
||||
}
|
||||
else
|
||||
@@ -488,14 +480,12 @@
|
||||
len--;
|
||||
}
|
||||
|
||||
-#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
|
||||
if (poolfs)
|
||||
{
|
||||
ret = xasprintf ("/%s/@%s", poolfs, buf3);
|
||||
free (buf3);
|
||||
}
|
||||
else
|
||||
-#endif
|
||||
ret = buf3;
|
||||
|
||||
return ret;
|
27
debian/patches/olpc_prefix_hack.patch
vendored
27
debian/patches/olpc_prefix_hack.patch
vendored
@ -5,7 +5,7 @@ Index: b/grub-core/kern/ieee1275/init.c
|
||||
===================================================================
|
||||
--- a/grub-core/kern/ieee1275/init.c
|
||||
+++ b/grub-core/kern/ieee1275/init.c
|
||||
@@ -53,6 +53,7 @@
|
||||
@@ -61,6 +61,7 @@
|
||||
grub_ieee1275_exit ();
|
||||
}
|
||||
|
||||
@ -13,37 +13,34 @@ Index: b/grub-core/kern/ieee1275/init.c
|
||||
/* Translate an OF filesystem path (separated by backslashes), into a GRUB
|
||||
path (separated by forward slashes). */
|
||||
static void
|
||||
@@ -67,13 +68,16 @@
|
||||
@@ -75,6 +76,7 @@
|
||||
backslash = grub_strchr (filepath, '\\');
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
void (*grub_ieee1275_net_config) (const char *dev,
|
||||
char **device,
|
||||
@@ -82,10 +84,15 @@
|
||||
void
|
||||
grub_machine_set_prefix (void)
|
||||
grub_machine_get_bootlocation (char **device, char **path)
|
||||
{
|
||||
+#ifndef __i386__
|
||||
char bootpath[64]; /* XXX check length */
|
||||
char *filename;
|
||||
char *prefix;
|
||||
char *type;
|
||||
+#endif
|
||||
|
||||
if (grub_prefix[0])
|
||||
{
|
||||
@@ -82,6 +86,9 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+#ifdef __i386__
|
||||
+ grub_env_set ("prefix", "(sd,1)/");
|
||||
+#else
|
||||
if (grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", &bootpath,
|
||||
sizeof (bootpath), 0))
|
||||
{
|
||||
@@ -120,6 +127,7 @@
|
||||
|
||||
grub_free (filename);
|
||||
grub_free (prefix);
|
||||
@@ -132,6 +139,7 @@
|
||||
*path = filename;
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
|
36
debian/patches/partition_performance.patch
vendored
36
debian/patches/partition_performance.patch
vendored
@ -1,36 +0,0 @@
|
||||
Description: Give up scanning partitions after ten consecutive open failures
|
||||
Scanning all the way up to 10000 is excessive and can cause serious
|
||||
performance problems in some configurations.
|
||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||
Bug-Ubuntu: https://bugs.launchpad.net/bugs/787461
|
||||
Forwarded: yes
|
||||
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3320
|
||||
Last-Update: 2011-05-27
|
||||
|
||||
Index: b/grub-core/kern/emu/hostdisk.c
|
||||
===================================================================
|
||||
--- a/grub-core/kern/emu/hostdisk.c
|
||||
+++ b/grub-core/kern/emu/hostdisk.c
|
||||
@@ -564,6 +564,7 @@
|
||||
int i;
|
||||
char real_dev[PATH_MAX];
|
||||
struct linux_partition_cache *cache;
|
||||
+ int missing = 0;
|
||||
|
||||
strcpy(real_dev, dev);
|
||||
|
||||
@@ -602,7 +603,13 @@
|
||||
|
||||
fd = open (real_dev, O_RDONLY);
|
||||
if (fd == -1)
|
||||
- continue;
|
||||
+ {
|
||||
+ if (missing++ < 10)
|
||||
+ continue;
|
||||
+ else
|
||||
+ return 0;
|
||||
+ }
|
||||
+ missing = 0;
|
||||
close (fd);
|
||||
|
||||
start = find_partition_start (real_dev);
|
26
debian/patches/probe_canonicalise.patch
vendored
26
debian/patches/probe_canonicalise.patch
vendored
@ -1,26 +0,0 @@
|
||||
Description: Canonicalise path argument to grub-probe
|
||||
This fixes use of "/path/.." as in grub-install for EFI, as well as
|
||||
handling symlinks correctly.
|
||||
Author: Mario Limonciello <mario_limonciello@dell.com>
|
||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||
Bug-Debian: http://bugs.debian.org/637768
|
||||
Forwarded: yes
|
||||
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3401
|
||||
Last-Update: 2011-08-15
|
||||
|
||||
Index: b/util/grub-probe.c
|
||||
===================================================================
|
||||
--- a/util/grub-probe.c
|
||||
+++ b/util/grub-probe.c
|
||||
@@ -108,7 +108,10 @@
|
||||
#endif
|
||||
}
|
||||
else
|
||||
- device_name = grub_guess_root_device (path);
|
||||
+ {
|
||||
+ grub_path = canonicalize_file_name (path);
|
||||
+ device_name = grub_guess_root_device (grub_path);
|
||||
+ }
|
||||
|
||||
if (! device_name)
|
||||
grub_util_error ("cannot find a device for %s (is /dev mounted?)", path);
|
18
debian/patches/qemu_img_exists.patch
vendored
18
debian/patches/qemu_img_exists.patch
vendored
@ -1,18 +0,0 @@
|
||||
Description: Skip partmap test if qemu-img doesn't exist (e.g. on the Hurd)
|
||||
Author: Colin Watson <cjwatson@debian.org>
|
||||
Forwarded: no
|
||||
Last-Update: 2010-11-22
|
||||
|
||||
Index: b/tests/partmap_test.in
|
||||
===================================================================
|
||||
--- a/tests/partmap_test.in
|
||||
+++ b/tests/partmap_test.in
|
||||
@@ -51,6 +51,8 @@
|
||||
echo
|
||||
}
|
||||
|
||||
+which qemu-img >/dev/null 2>&1 || exit 77
|
||||
+
|
||||
imgfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
outfile=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
|
32
debian/patches/series
vendored
32
debian/patches/series
vendored
@ -8,38 +8,6 @@ gfxpayload_keep_default.patch
|
||||
mkrescue_diet.patch
|
||||
mkconfig_skip_dmcrypt.patch
|
||||
install_stage2_confusion.patch
|
||||
qemu_img_exists.patch
|
||||
branch_devmapper.patch
|
||||
branch_squash.patch
|
||||
branch_longlinuxcmd.patch
|
||||
branch_parse-color.patch
|
||||
branch_embed-sectors.patch
|
||||
branch_fuse.patch
|
||||
mkrescue_efi_modules.patch
|
||||
mkconfig_loopback.patch
|
||||
lazy_stat.patch
|
||||
btrfs_stat.patch
|
||||
partition_performance.patch
|
||||
kfreebsd-9_ada_devices.patch
|
||||
gfxterm_background.patch
|
||||
zfs_packed_la_array.patch
|
||||
xen_replace.patch
|
||||
kfreebsd_mfi_devices.patch
|
||||
probe_canonicalise.patch
|
||||
mkconfig_skip_readme.patch
|
||||
kfreebsd_lvm.patch
|
||||
zfs_update.patch
|
||||
no_libzfs.patch
|
||||
xfs_invalid_bmap.patch
|
||||
handle_new_autotools.patch
|
||||
bash-completion_identifiers.patch
|
||||
mkconfig_gnumach.patch
|
||||
gcc_4_6_space.patch
|
||||
lzo.patch
|
||||
fat_uuid.patch
|
||||
efiemu_fix.patch
|
||||
4k_sectors.patch
|
||||
efi_disk_cache.patch
|
||||
dirlen.patch
|
||||
hurd.patch
|
||||
userland-part.patch
|
||||
|
149
debian/patches/userland-part.patch
vendored
149
debian/patches/userland-part.patch
vendored
@ -1,149 +0,0 @@
|
||||
Description: Handle hurd userspace partitions.
|
||||
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||
Origin: upstream, http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/4290
|
||||
Forwarded: not-needed
|
||||
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/4290
|
||||
Last-Update: 2012-06-08
|
||||
|
||||
--- a/grub-core/kern/emu/getroot.c 2012-05-03 20:59:16 +0000
|
||||
+++ b/grub-core/kern/emu/getroot.c 2012-05-03 21:41:46 +0000
|
||||
@@ -337,6 +337,75 @@
|
||||
|
||||
#elif defined (__GNU__)
|
||||
|
||||
+static char *
|
||||
+find_hurd_root_device (const char *path)
|
||||
+{
|
||||
+ file_t file;
|
||||
+ error_t err;
|
||||
+ char *argz = NULL, *name = NULL, *ret;
|
||||
+ size_t argz_len = 0;
|
||||
+ int i;
|
||||
+
|
||||
+ file = file_name_lookup (path, 0, 0);
|
||||
+ if (file == MACH_PORT_NULL)
|
||||
+ grub_util_error ("cannot open `%s': %s", path, strerror (errno));
|
||||
+
|
||||
+ /* This returns catenated 0-terminated strings. */
|
||||
+ err = file_get_fs_options (file, &argz, &argz_len);
|
||||
+ if (err)
|
||||
+ grub_util_error ("cannot get filesystem options "
|
||||
+ "for path `%s': %s", path, strerror(err));
|
||||
+ if (argz_len == 0)
|
||||
+ /* TRANSLATORS: a "translator" is similar to a filesystem, but handled by a
|
||||
+ * userland daemon. */
|
||||
+ grub_util_error ("translator is empty for path `%s'", path);
|
||||
+
|
||||
+ /* Make sure the string is terminated. */
|
||||
+ argz[argz_len-1] = 0;
|
||||
+
|
||||
+ /* Skip first word (translator path) and options. */
|
||||
+ for (i = strlen (argz) + 1; i < argz_len; i += strlen (argz + i) + 1)
|
||||
+ {
|
||||
+ if (argz[i] != '-')
|
||||
+ {
|
||||
+ /* Non-option. Only accept one, assumed to be the FS path. */
|
||||
+ /* XXX: this should be replaced by an RPC to the translator. */
|
||||
+ if (name)
|
||||
+ /* TRANSLATORS: we expect to get something like
|
||||
+ /hurd/foobar --option1 --option2=baz /dev/something
|
||||
+ */
|
||||
+ grub_util_error ("translator `%s' for path `%s' has several "
|
||||
+ "non-option words, at least `%s' and `%s'",
|
||||
+ argz, path, name, argz + i);
|
||||
+ name = argz + i;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!name)
|
||||
+ /* TRANSLATORS: we expect to get something like
|
||||
+ /hurd/foobar --option1 --option2=baz /dev/something
|
||||
+ */
|
||||
+ grub_util_error ("translator `%s' for path `%s' is given only options, "
|
||||
+ "cannot find device part", argz, path);
|
||||
+
|
||||
+ if (strncmp (name, "device:", sizeof ("device:") - 1) == 0)
|
||||
+ {
|
||||
+ char *dev_name = name + sizeof ("device:") - 1;
|
||||
+ size_t size = sizeof ("/dev/") - 1 + strlen (dev_name) + 1;
|
||||
+ char *next;
|
||||
+ ret = malloc (size);
|
||||
+ next = stpncpy (ret, "/dev/", size);
|
||||
+ stpncpy (next, dev_name, size - (next - ret));
|
||||
+ }
|
||||
+ else if (!strncmp (name, "file:", sizeof ("file:") - 1))
|
||||
+ ret = strdup (name + sizeof ("file:") - 1);
|
||||
+ else
|
||||
+ ret = strdup (name);
|
||||
+
|
||||
+ munmap (argz, argz_len);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
#elif ! defined(__CYGWIN__)
|
||||
|
||||
char *
|
||||
@@ -565,61 +634,8 @@
|
||||
{
|
||||
char *os_dev = NULL;
|
||||
#ifdef __GNU__
|
||||
- file_t file;
|
||||
- mach_port_t *ports;
|
||||
- int *ints;
|
||||
- loff_t *offsets;
|
||||
- char *data;
|
||||
- error_t err;
|
||||
- mach_msg_type_number_t num_ports = 0, num_ints = 0, num_offsets = 0, data_len = 0;
|
||||
- size_t name_len;
|
||||
-
|
||||
- file = file_name_lookup (dir, 0, 0);
|
||||
- if (file == MACH_PORT_NULL)
|
||||
- return 0;
|
||||
-
|
||||
- err = file_get_storage_info (file,
|
||||
- &ports, &num_ports,
|
||||
- &ints, &num_ints,
|
||||
- &offsets, &num_offsets,
|
||||
- &data, &data_len);
|
||||
-
|
||||
- if (num_ints < 1)
|
||||
- grub_util_error ("Storage info for `%s' does not include type", dir);
|
||||
- if (ints[0] != STORAGE_DEVICE)
|
||||
- grub_util_error ("Filesystem of `%s' is not stored on local disk", dir);
|
||||
-
|
||||
- if (num_ints < 5)
|
||||
- grub_util_error ("Storage info for `%s' does not include name", dir);
|
||||
- name_len = ints[4];
|
||||
- if (name_len < data_len)
|
||||
- grub_util_error ("Bogus name length for storage info for `%s'", dir);
|
||||
- if (data[name_len - 1] != '\0')
|
||||
- grub_util_error ("Storage name for `%s' not NUL-terminated", dir);
|
||||
-
|
||||
- os_dev = xmalloc (strlen ("/dev/") + data_len);
|
||||
- memcpy (os_dev, "/dev/", strlen ("/dev/"));
|
||||
- memcpy (os_dev + strlen ("/dev/"), data, data_len);
|
||||
-
|
||||
- if (ports && num_ports > 0)
|
||||
- {
|
||||
- mach_msg_type_number_t i;
|
||||
- for (i = 0; i < num_ports; i++)
|
||||
- {
|
||||
- mach_port_t port = ports[i];
|
||||
- if (port != MACH_PORT_NULL)
|
||||
- mach_port_deallocate (mach_task_self(), port);
|
||||
- }
|
||||
- munmap ((caddr_t) ports, num_ports * sizeof (*ports));
|
||||
- }
|
||||
-
|
||||
- if (ints && num_ints > 0)
|
||||
- munmap ((caddr_t) ints, num_ints * sizeof (*ints));
|
||||
- if (offsets && num_offsets > 0)
|
||||
- munmap ((caddr_t) offsets, num_offsets * sizeof (*offsets));
|
||||
- if (data && data_len > 0)
|
||||
- munmap (data, data_len);
|
||||
- mach_port_deallocate (mach_task_self (), file);
|
||||
+ /* GNU/Hurd specific function. */
|
||||
+ os_dev = find_hurd_root_device (dir);
|
||||
#else /* !__GNU__ */
|
||||
struct stat st;
|
||||
dev_t dev;
|
64
debian/patches/xen_replace.patch
vendored
64
debian/patches/xen_replace.patch
vendored
@ -1,64 +0,0 @@
|
||||
Description: New GRUB_CMDLINE_LINUX_XEN_REPLACE* options
|
||||
Honour GRUB_CMDLINE_LINUX_XEN_REPLACE and
|
||||
GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT, which replace GRUB_CMDLINE_LINUX
|
||||
and GRUB_CMDLINE_LINUX_DEFAULT (complementing the existing options which
|
||||
append).
|
||||
Author: Colin Watson <cjwatson@ubuntu.com>
|
||||
Bug-Debian: http://bugs.debian.org/617538
|
||||
Forwarded: yes
|
||||
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3294
|
||||
Last-Update: 2011-08-08
|
||||
|
||||
Index: b/docs/grub.texi
|
||||
===================================================================
|
||||
--- a/docs/grub.texi
|
||||
+++ b/docs/grub.texi
|
||||
@@ -1169,8 +1169,14 @@
|
||||
|
||||
@item GRUB_CMDLINE_XEN
|
||||
@itemx GRUB_CMDLINE_XEN_DEFAULT
|
||||
-As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, but for
|
||||
-Linux and Xen.
|
||||
+The values of these options are appended to the values of
|
||||
+@samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux
|
||||
+and Xen menu entries.
|
||||
+
|
||||
+@item GRUB_CMDLINE_LINUX_XEN_REPLACE
|
||||
+@item GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT
|
||||
+The values of these options replace the values of @samp{GRUB_CMDLINE_LINUX}
|
||||
+and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux and Xen menu entries.
|
||||
|
||||
@item GRUB_DISABLE_LINUX_UUID
|
||||
Normally, @command{grub-mkconfig} will generate menu entries that use
|
||||
Index: b/util/grub.d/20_linux_xen.in
|
||||
===================================================================
|
||||
--- a/util/grub.d/20_linux_xen.in
|
||||
+++ b/util/grub.d/20_linux_xen.in
|
||||
@@ -56,6 +56,14 @@
|
||||
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
|
||||
fi
|
||||
|
||||
+# Allow overriding GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT.
|
||||
+if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE}" ]; then
|
||||
+ GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX_XEN_REPLACE}"
|
||||
+fi
|
||||
+if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}" ]; then
|
||||
+ GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}"
|
||||
+fi
|
||||
+
|
||||
if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ] \
|
||||
|| [ "x`stat -f --printf=%T /`" = xbtrfs ]; then
|
||||
rootsubvol="`make_system_path_relative_to_its_root /`"
|
||||
Index: b/util/grub-mkconfig.in
|
||||
===================================================================
|
||||
--- a/util/grub-mkconfig.in
|
||||
+++ b/util/grub-mkconfig.in
|
||||
@@ -239,6 +239,8 @@
|
||||
GRUB_CMDLINE_LINUX_DEFAULT \
|
||||
GRUB_CMDLINE_XEN \
|
||||
GRUB_CMDLINE_XEN_DEFAULT \
|
||||
+ GRUB_CMDLINE_LINUX_XEN_REPLACE \
|
||||
+ GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT \
|
||||
GRUB_CMDLINE_NETBSD \
|
||||
GRUB_CMDLINE_NETBSD_DEFAULT \
|
||||
GRUB_TERMINAL_INPUT \
|
188
debian/patches/xfs_invalid_bmap.patch
vendored
188
debian/patches/xfs_invalid_bmap.patch
vendored
@ -1,188 +0,0 @@
|
||||
Description: Rewrite XFS btree parsing; fixes invalid BMAP
|
||||
Author: Vladimir Serbinenko <phcoder@gmail.com>
|
||||
Bug: http://savannah.gnu.org/bugs/?34213
|
||||
Bug-Debian: http://bugs.debian.org/657776
|
||||
Applied-Upstream: http://bazaar.launchpad.net/~vcs-imports/grub/grub2-bzr/revision/3443
|
||||
Last-Update: 2012-01-29
|
||||
|
||||
Index: b/grub-core/fs/xfs.c
|
||||
===================================================================
|
||||
--- a/grub-core/fs/xfs.c
|
||||
+++ b/grub-core/fs/xfs.c
|
||||
@@ -111,7 +111,9 @@
|
||||
grub_uint64_t nblocks;
|
||||
grub_uint32_t extsize;
|
||||
grub_uint32_t nextents;
|
||||
- grub_uint8_t unused3[20];
|
||||
+ grub_uint16_t unused3;
|
||||
+ grub_uint8_t fork_offset;
|
||||
+ grub_uint8_t unused4[17];
|
||||
union
|
||||
{
|
||||
char raw[156];
|
||||
@@ -145,7 +147,7 @@
|
||||
grub_disk_t disk;
|
||||
int pos;
|
||||
int bsize;
|
||||
- int agsize;
|
||||
+ grub_uint32_t agsize;
|
||||
struct grub_fshelp_node diropen;
|
||||
};
|
||||
|
||||
@@ -159,33 +161,67 @@
|
||||
#define FILETYPE_INO_DIRECTORY 0040000
|
||||
#define FILETYPE_INO_SYMLINK 0120000
|
||||
|
||||
-#define GRUB_XFS_INO_AGBITS(data) \
|
||||
- ((data)->sblock.log2_agblk + (data)->sblock.log2_inop)
|
||||
-#define GRUB_XFS_INO_INOINAG(data, ino) \
|
||||
- (grub_be_to_cpu64 (ino) & ((1LL << GRUB_XFS_INO_AGBITS (data)) - 1))
|
||||
-#define GRUB_XFS_INO_AG(data,ino) \
|
||||
- (grub_be_to_cpu64 (ino) >> GRUB_XFS_INO_AGBITS (data))
|
||||
-
|
||||
-#define GRUB_XFS_FSB_TO_BLOCK(data, fsb) \
|
||||
- (((fsb) >> (data)->sblock.log2_agblk) * (data)->agsize \
|
||||
- + ((fsb) & ((1LL << (data)->sblock.log2_agblk) - 1)))
|
||||
-
|
||||
-#define GRUB_XFS_EXTENT_OFFSET(exts,ex) \
|
||||
- ((grub_be_to_cpu32 (exts[ex][0]) & ~(1 << 31)) << 23 \
|
||||
- | grub_be_to_cpu32 (exts[ex][1]) >> 9)
|
||||
-
|
||||
-#define GRUB_XFS_EXTENT_BLOCK(exts,ex) \
|
||||
- ((grub_uint64_t) (grub_be_to_cpu32 (exts[ex][1]) \
|
||||
- & (0x1ff)) << 43 \
|
||||
- | (grub_uint64_t) grub_be_to_cpu32 (exts[ex][2]) << 11 \
|
||||
- | grub_be_to_cpu32 (exts[ex][3]) >> 21)
|
||||
-
|
||||
-#define GRUB_XFS_EXTENT_SIZE(exts,ex) \
|
||||
- (grub_be_to_cpu32 (exts[ex][3]) & ((1 << 20) - 1))
|
||||
-
|
||||
-#define GRUB_XFS_ROUND_TO_DIRENT(pos) ((((pos) + 8 - 1) / 8) * 8)
|
||||
-#define GRUB_XFS_NEXT_DIRENT(pos,len) \
|
||||
- (pos) + GRUB_XFS_ROUND_TO_DIRENT (8 + 1 + len + 2)
|
||||
+static inline int
|
||||
+GRUB_XFS_INO_AGBITS(struct grub_xfs_data *data)
|
||||
+{
|
||||
+ return ((data)->sblock.log2_agblk + (data)->sblock.log2_inop);
|
||||
+}
|
||||
+
|
||||
+static inline grub_uint64_t
|
||||
+GRUB_XFS_INO_INOINAG (struct grub_xfs_data *data,
|
||||
+ grub_uint64_t ino)
|
||||
+{
|
||||
+ return (grub_be_to_cpu64 (ino) & ((1LL << GRUB_XFS_INO_AGBITS (data)) - 1));
|
||||
+}
|
||||
+
|
||||
+static inline grub_uint64_t
|
||||
+GRUB_XFS_INO_AG (struct grub_xfs_data *data,
|
||||
+ grub_uint64_t ino)
|
||||
+{
|
||||
+ return (grub_be_to_cpu64 (ino) >> GRUB_XFS_INO_AGBITS (data));
|
||||
+}
|
||||
+
|
||||
+static inline grub_disk_addr_t
|
||||
+GRUB_XFS_FSB_TO_BLOCK (struct grub_xfs_data *data, grub_disk_addr_t fsb)
|
||||
+{
|
||||
+ return ((fsb >> data->sblock.log2_agblk) * data->agsize
|
||||
+ + (fsb & ((1LL << data->sblock.log2_agblk) - 1)));
|
||||
+}
|
||||
+
|
||||
+static inline grub_uint64_t
|
||||
+GRUB_XFS_EXTENT_OFFSET (grub_xfs_extent *exts, int ex)
|
||||
+{
|
||||
+ return ((grub_be_to_cpu32 (exts[ex][0]) & ~(1 << 31)) << 23
|
||||
+ | grub_be_to_cpu32 (exts[ex][1]) >> 9);
|
||||
+}
|
||||
+
|
||||
+static inline grub_uint64_t
|
||||
+GRUB_XFS_EXTENT_BLOCK (grub_xfs_extent *exts, int ex)
|
||||
+{
|
||||
+ return ((grub_uint64_t) (grub_be_to_cpu32 (exts[ex][1])
|
||||
+ & (0x1ff)) << 43
|
||||
+ | (grub_uint64_t) grub_be_to_cpu32 (exts[ex][2]) << 11
|
||||
+ | grub_be_to_cpu32 (exts[ex][3]) >> 21);
|
||||
+}
|
||||
+
|
||||
+static inline grub_uint64_t
|
||||
+GRUB_XFS_EXTENT_SIZE (grub_xfs_extent *exts, int ex)
|
||||
+{
|
||||
+ return (grub_be_to_cpu32 (exts[ex][3]) & ((1 << 20) - 1));
|
||||
+}
|
||||
+
|
||||
+static inline int
|
||||
+GRUB_XFS_ROUND_TO_DIRENT (int pos)
|
||||
+{
|
||||
+ return ((((pos) + 8 - 1) / 8) * 8);
|
||||
+}
|
||||
+
|
||||
+static inline int
|
||||
+GRUB_XFS_NEXT_DIRENT (int pos, int len)
|
||||
+{
|
||||
+ return (pos) + GRUB_XFS_ROUND_TO_DIRENT (8 + 1 + len + 2);
|
||||
+}
|
||||
+
|
||||
|
||||
static inline grub_uint64_t
|
||||
grub_xfs_inode_block (struct grub_xfs_data *data,
|
||||
@@ -241,13 +277,23 @@
|
||||
if (node->inode.format == XFS_INODE_FORMAT_BTREE)
|
||||
{
|
||||
grub_uint64_t *keys;
|
||||
+ int recoffset;
|
||||
|
||||
- leaf = grub_malloc (node->data->sblock.bsize);
|
||||
+ leaf = grub_malloc (node->data->bsize);
|
||||
if (leaf == 0)
|
||||
return 0;
|
||||
|
||||
nrec = grub_be_to_cpu16 (node->inode.data.btree.numrecs);
|
||||
keys = &node->inode.data.btree.keys[0];
|
||||
+ if (node->inode.fork_offset)
|
||||
+ recoffset = (node->inode.fork_offset
|
||||
+ - ((char *) &node->inode.data.btree.keys - (char *) &node->inode))
|
||||
+ / (2 * sizeof (grub_uint64_t));
|
||||
+ else
|
||||
+ recoffset = ((1 << node->data->sblock.log2_inode)
|
||||
+ - ((char *) &node->inode.data.btree.keys
|
||||
+ - (char *) &node->inode))
|
||||
+ / (2 * sizeof (grub_uint64_t));
|
||||
do
|
||||
{
|
||||
int i;
|
||||
@@ -264,12 +310,9 @@
|
||||
grub_free (leaf);
|
||||
return 0;
|
||||
}
|
||||
-
|
||||
if (grub_disk_read (node->data->disk,
|
||||
- grub_be_to_cpu64 (keys[i - 1 + nrec])
|
||||
- << (node->data->sblock.log2_bsize
|
||||
- - GRUB_DISK_SECTOR_BITS),
|
||||
- 0, node->data->sblock.bsize, leaf))
|
||||
+ GRUB_XFS_FSB_TO_BLOCK (node->data, grub_be_to_cpu64 (keys[i - 1 + recoffset])) << (node->data->sblock.log2_bsize - GRUB_DISK_SECTOR_BITS),
|
||||
+ 0, node->data->bsize, leaf))
|
||||
return 0;
|
||||
|
||||
if (grub_strncmp ((char *) leaf->magic, "BMAP", 4))
|
||||
@@ -281,7 +324,11 @@
|
||||
|
||||
nrec = grub_be_to_cpu16 (leaf->numrecs);
|
||||
keys = &leaf->keys[0];
|
||||
- } while (leaf->level);
|
||||
+ recoffset = ((node->data->bsize - ((char *) &leaf->keys
|
||||
+ - (char *) leaf))
|
||||
+ / (2 * sizeof (grub_uint64_t)));
|
||||
+ }
|
||||
+ while (leaf->level);
|
||||
exts = (grub_xfs_extent *) keys;
|
||||
}
|
||||
else if (node->inode.format == XFS_INODE_FORMAT_EXT)
|
||||
@@ -328,7 +375,7 @@
|
||||
grub_xfs_read_file (grub_fshelp_node_t node,
|
||||
void NESTED_FUNC_ATTR (*read_hook) (grub_disk_addr_t sector,
|
||||
unsigned offset, unsigned length),
|
||||
- int pos, grub_size_t len, char *buf)
|
||||
+ grub_off_t pos, grub_size_t len, char *buf)
|
||||
{
|
||||
return grub_fshelp_read_file (node->data->disk, node, read_hook,
|
||||
pos, len, buf, grub_xfs_read_block,
|
17
debian/patches/zfs_packed_la_array.patch
vendored
17
debian/patches/zfs_packed_la_array.patch
vendored
@ -1,17 +0,0 @@
|
||||
2011-08-03 Robert Millan <rmh@gnu.org>
|
||||
|
||||
* include/grub/zfs/zap_leaf.h (typedef union zap_leaf_chunk): Mark
|
||||
la_array as packed.
|
||||
Reported by: Zachary Bedell
|
||||
|
||||
--- a/include/grub/zfs/zap_leaf.h
|
||||
+++ b/include/grub/zfs/zap_leaf.h
|
||||
@@ -90,7 +90,7 @@
|
||||
{
|
||||
grub_uint8_t la_array[ZAP_LEAF_ARRAY_BYTES];
|
||||
grub_uint64_t la_array64;
|
||||
- };
|
||||
+ } __attribute__ ((packed));
|
||||
grub_uint16_t la_next; /* next blk or CHAIN_END */
|
||||
} l_array;
|
||||
struct zap_leaf_free {
|
2415
debian/patches/zfs_update.patch
vendored
2415
debian/patches/zfs_update.patch
vendored
File diff suppressed because it is too large
Load Diff
6
debian/rules
vendored
6
debian/rules
vendored
@ -149,13 +149,15 @@ build/stamps/build-grub-rescue-pc: build/stamps/build-grub-pc
|
||||
mkdir -p build/grub-rescue-pc/lib/grub
|
||||
rm -rf build/grub-rescue-pc/lib/grub/i386-pc
|
||||
cp -a build/grub-pc/grub-core build/grub-rescue-pc/lib/grub/i386-pc
|
||||
$(CURDIR)/build/grub-rescue-pc/grub-mkrescue \
|
||||
pkgdatadir=$(CURDIR)/build/grub-rescue-pc \
|
||||
$(CURDIR)/build/grub-rescue-pc/grub-mkrescue \
|
||||
--grub-mkimage=$(CURDIR)/build/grub-pc/grub-mkimage \
|
||||
--output=$(CURDIR)/build/grub-rescue-pc/grub-rescue-cdrom.iso \
|
||||
$(CURDIR)/build/grub-rescue-pc/rescue-disk
|
||||
# save space for floppy image
|
||||
rm -rf build/grub-rescue-pc/lib/grub/i386-pc/po
|
||||
$(CURDIR)/build/grub-rescue-pc/grub-mkrescue \
|
||||
pkgdatadir=$(CURDIR)/build/grub-rescue-pc \
|
||||
$(CURDIR)/build/grub-rescue-pc/grub-mkrescue \
|
||||
--grub-mkimage=$(CURDIR)/build/grub-pc/grub-mkimage \
|
||||
--output=$(CURDIR)/build/grub-rescue-pc/grub-rescue-floppy.img \
|
||||
--diet \
|
||||
|
@ -4,4 +4,6 @@ AUTOMAKE_OPTIONS = subdir-objects
|
||||
info_TEXINFOS = grub.texi grub-dev.texi
|
||||
grub_TEXINFOS = fdl.texi
|
||||
|
||||
EXTRA_DIST = font_char_metrics.png font_char_metrics.txt
|
||||
|
||||
|
||||
|
@ -77,6 +77,7 @@ This edition documents version @value{VERSION}.
|
||||
* Finding your way around::
|
||||
* Coding style::
|
||||
* Contributing Changes::
|
||||
* Porting::
|
||||
* Error Handling::
|
||||
* CIA::
|
||||
* BIOS port memory map::
|
||||
@ -447,6 +448,315 @@ If your intention is to just get started, please do not submit a inclusion
|
||||
request. Instead, please subscribe to the mailing list, and communicate first
|
||||
(e.g. sending a patch, asking a question, commenting on another message...).
|
||||
|
||||
@node Porting
|
||||
@chapter Porting
|
||||
|
||||
GRUB2 is designed to be easily portable accross platforms. But because of the
|
||||
nature of bootloader every new port must be done separately. Here is how I did
|
||||
MIPS (loongson and ARC) and Xen ports. Note than this is more of suggestions,
|
||||
not absolute truth.
|
||||
|
||||
First of all grab any architecture specifications you can find in public
|
||||
(please avoid NDA).
|
||||
|
||||
First stage is ``Hello world''. I've done it outside of GRUB for simplicity.
|
||||
Your task is to have a small program which is loadable as bootloader and
|
||||
clearly shows its presence to you. If you have easily accessible console
|
||||
you can just print a message. If you have a mapped framebuffer you know address
|
||||
of, you can draw a square. If you have a debug facility, just hanging without
|
||||
crashing might be enough. For the first stage you can choose to load the
|
||||
bootloader across the network since format for network image is often easier
|
||||
than for local boot and it skips the need of small intermediary stages and
|
||||
nvram handling. Additionally you can often have a good idea of the needed
|
||||
format by running ``file'' on any netbootable executable for given platform.
|
||||
|
||||
This program should probably have 2 parts: an assembler and C one. Assembler one
|
||||
handles BSS cleaning and other needed setup (on some platforms you may need
|
||||
to switch modes or copy the executable to its definitive position). So your code
|
||||
may look like (x86 assembly for illustration purposes)
|
||||
|
||||
@example
|
||||
.globl _start
|
||||
_start:
|
||||
movl $_bss_start, %edi
|
||||
movl $_end, %ecx
|
||||
subl %edi, %ecx
|
||||
xorl %eax, %eax
|
||||
cld
|
||||
rep
|
||||
stosb
|
||||
call main
|
||||
@end example
|
||||
|
||||
@example
|
||||
|
||||
static const char msg[] = "Hello, world";
|
||||
|
||||
void
|
||||
putchar (int c)
|
||||
@{
|
||||
...
|
||||
@}
|
||||
|
||||
void
|
||||
main (void)
|
||||
@{
|
||||
const char *ptr = msg;
|
||||
while (*ptr)
|
||||
putchar (*ptr++);
|
||||
while (1);
|
||||
@}
|
||||
@end example
|
||||
|
||||
Sometimes you need a third file: assembly stubs for ABI-compatibility.
|
||||
|
||||
Once this file is functional it's time to move it into GRUB2. The startup
|
||||
assembly file goes to grub-core/kern/$cpu/$platform/startup.S. You should also
|
||||
include grub/symbol.h and replace call to entry point with call to
|
||||
EXT_C(grub_main). The C file goes to grub-core/kern/$cpu/$platform/init.c
|
||||
and its entry point is renamed to void grub_machine_init (void). Keep final
|
||||
infinite loop for now. Stubs file if any goes to
|
||||
grub-core/kern/$cpu/$platform/callwrap.S. Sometimes either $cpu or $platform
|
||||
is dropped if file is used on several cpus respectivelyplatforms.
|
||||
Check those locations if they already have what you're looking for.
|
||||
|
||||
Then modify in configure.ac the following parts:
|
||||
|
||||
CPU names:
|
||||
|
||||
@example
|
||||
case "$target_cpu" in
|
||||
i[[3456]]86) target_cpu=i386 ;;
|
||||
amd64) target_cpu=x86_64 ;;
|
||||
sparc) target_cpu=sparc64 ;;
|
||||
s390x) target_cpu=s390 ;;
|
||||
...
|
||||
esac
|
||||
@end example
|
||||
|
||||
Sometimes CPU have additional architecture names which don't influence booting.
|
||||
You might want to have some canonical name to avoid having bunch of identical
|
||||
platforms with different names.
|
||||
|
||||
NOTE: it doesn't influence compile optimisations which depend solely on
|
||||
chosen compiler and compile options.
|
||||
|
||||
@example
|
||||
if test "x$with_platform" = x; then
|
||||
case "$target_cpu"-"$target_vendor" in
|
||||
i386-apple) platform=efi ;;
|
||||
i386-*) platform=pc ;;
|
||||
x86_64-apple) platform=efi ;;
|
||||
x86_64-*) platform=pc ;;
|
||||
powerpc-*) platform=ieee1275 ;;
|
||||
...
|
||||
esac
|
||||
else
|
||||
...
|
||||
fi
|
||||
@end example
|
||||
|
||||
This part deals with guessing the platform from CPU and vendor. Sometimes you
|
||||
need to use 32-bit mode for booting even if OS runs in 64-bit one. If so add
|
||||
your platform to:
|
||||
|
||||
@example
|
||||
case "$target_cpu"-"$platform" in
|
||||
x86_64-efi) ;;
|
||||
x86_64-emu) ;;
|
||||
x86_64-*) target_cpu=i386 ;;
|
||||
powerpc64-ieee1275) target_cpu=powerpc ;;
|
||||
esac
|
||||
@end example
|
||||
|
||||
Add your platform to the list of supported ones:
|
||||
|
||||
@example
|
||||
case "$target_cpu"-"$platform" in
|
||||
i386-efi) ;;
|
||||
x86_64-efi) ;;
|
||||
i386-pc) ;;
|
||||
i386-multiboot) ;;
|
||||
i386-coreboot) ;;
|
||||
...
|
||||
esac
|
||||
@end example
|
||||
|
||||
If explicit -m32 or -m64 is needed add it to:
|
||||
|
||||
@example
|
||||
case "$target_cpu" in
|
||||
i386 | powerpc) target_m32=1 ;;
|
||||
x86_64 | sparc64) target_m64=1 ;;
|
||||
esac
|
||||
@end example
|
||||
|
||||
Finally you need to add a conditional to the following block:
|
||||
|
||||
@example
|
||||
AM_CONDITIONAL([COND_mips_arc], [test x$target_cpu = xmips -a x$platform = xarc])
|
||||
AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
|
||||
AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
|
||||
@end example
|
||||
|
||||
Next stop is gentpl.py. You need to add your platform to the list of supported
|
||||
ones (sorry that this list is duplicated):
|
||||
|
||||
@example
|
||||
GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
|
||||
"i386_multiboot", "i386_ieee1275", "x86_64_efi",
|
||||
"mips_loongson", "sparc64_ieee1275",
|
||||
"powerpc_ieee1275", "mips_arc", "ia64_efi",
|
||||
"mips_qemu_mips", "s390_mainframe" ]
|
||||
@end example
|
||||
|
||||
You may also want already to add new platform to one or several of available
|
||||
groups. In particular we always have a group for each CPU even when only
|
||||
one platform for given CPU is available.
|
||||
|
||||
Then comes grub-core/Makefile.core.def. In the block ``kernel'' you'll need
|
||||
to define ldflags for your platform ($cpu_$platform_ldflags). You also need to
|
||||
declare startup asm file ($cpu_$platform_startup) as well as any other files
|
||||
(e.g. init.c and callwrap.S) (e.g. $cpu_$platform = kern/$cpu/$platform/init.c).
|
||||
At this stage you will also need to add dummy dl.c and cache.S with functions
|
||||
grub_err_t grub_arch_dl_check_header (void *ehdr), grub_err_t
|
||||
grub_arch_dl_relocate_symbols (grub_dl_t mod, void *ehdr) (dl.c) and
|
||||
void grub_arch_sync_caches (void *address, grub_size_t len) (cache.S). They
|
||||
won't be used for now.
|
||||
|
||||
You will need to create directory include/$cpu/$platform and a file
|
||||
include/$cpu/types.h. The later folowing this template:
|
||||
|
||||
@example
|
||||
#ifndef GRUB_TYPES_CPU_HEADER
|
||||
#define GRUB_TYPES_CPU_HEADER 1
|
||||
|
||||
/* The size of void *. */
|
||||
#define GRUB_TARGET_SIZEOF_VOID_P 4
|
||||
|
||||
/* The size of long. */
|
||||
#define GRUB_TARGET_SIZEOF_LONG 4
|
||||
|
||||
/* mycpu is big-endian. */
|
||||
#define GRUB_TARGET_WORDS_BIGENDIAN 1
|
||||
/* Alternatively: mycpu is little-endian. */
|
||||
#undef GRUB_TARGET_WORDS_BIGENDIAN
|
||||
|
||||
#endif /* ! GRUB_TYPES_CPU_HEADER */
|
||||
@end example
|
||||
|
||||
You will also need to add a dummy file to datetime and setjmp modules to
|
||||
avoid any of it having no files. It can be just completely empty at this stage.
|
||||
|
||||
You'll need to make grub-mkimage.c (util/grub_mkimage.c) aware of the needed
|
||||
format. For most commonly used formats like ELF, PE, aout or raw the support
|
||||
is already present and you'll need to make it follow the existant code paths
|
||||
for your platform adding adjustments if necessary. When done compile:
|
||||
|
||||
@example
|
||||
./autogen.sh
|
||||
./configure --target=$cpu --with-platform=$platform TARGET_CC=.. OBJCOPY=... STRIP=...
|
||||
make > /dev/null
|
||||
@end example
|
||||
|
||||
And create image
|
||||
|
||||
@example
|
||||
./grub-mkimage -d grub-core -O $format_id -o test.img
|
||||
@end example
|
||||
|
||||
And it's time to test your test.img.
|
||||
|
||||
If it works next stage is to have heap, console and timer.
|
||||
|
||||
To have the heap working you need to determine which regions are suitable for
|
||||
heap usage, allocate them from firmware and map (if applicable). Then call
|
||||
grub_mm_init_region (vois *start, grub_size_t s) for every of this region.
|
||||
As a shortcut for early port you can allocate right after _end or have
|
||||
a big static array for heap. If you do you'll probably need to come back to
|
||||
this later. As for output console you should distinguish between an array of
|
||||
text, terminfo or graphics-based console. Many of real-world examples don't
|
||||
fit perfectly into any of these categories but one of the models is easier
|
||||
to be used as base. In second and third case you should add your platform to
|
||||
terminfokernel respectively videoinkernel group. A good example of array of
|
||||
text is i386-pc (kern/i386/pc/init.c and term/i386/pc/console.c).
|
||||
Of terminfo is ieee1275 (kern/ieee1275/init.c and term/ieee1275/console.c).
|
||||
Of video is loongson (kern/mips/loongson/init.c). Note that terminfo has
|
||||
to be inited in 2 stages: one before (to get at least rudimentary console
|
||||
as early as possible) and another after the heap (to get full-featured console).
|
||||
For the input there are string of keys, terminfo and direct hardware. For string
|
||||
of keys look at i386-pc (same files), for termino ieee1275 (same files) and for
|
||||
hardware loongson (kern/mips/loongson/init.c and term/at_keyboard.c).
|
||||
|
||||
For the timer you'll need to call grub_install_get_time_ms (...) with as sole
|
||||
argument a function returning a grub_uint64_t of a number of milliseconds
|
||||
elapsed since arbitrary point in the past.
|
||||
|
||||
Once these steps accomplished you can remove the inifinite loop and you should
|
||||
be able to get to the minimal console. Next step is to have module loading
|
||||
working. For this you'll need to fill kern/$cpu/dl.c and kern/$cpu/cache.S
|
||||
with real handling of relocations and respectively the real sync of I and D
|
||||
caches. Also you'll need to decide where in the image to store the modules.
|
||||
Usual way is to have it concatenated at the end. In this case you'll need to
|
||||
modify startup.S to copy modules out of bss to let's say ALIGN_UP (_end, 8)
|
||||
before cleaning out bss. You'll probably find useful to add total_module_size
|
||||
field to startup.S. In init.c you need to set grub_modbase to the address
|
||||
where modules can be found. You may need grub_modules_get_end () to avoid
|
||||
declaring the space occupied by modules as usable for heap. You can test modules
|
||||
with:
|
||||
|
||||
@example
|
||||
./grub-mkimage -d grub-core -O $format_id -o test.img hello
|
||||
@end example
|
||||
|
||||
and then running ``hello'' in the shell.
|
||||
|
||||
Once this works, you should think of implementing disk access. Look around
|
||||
disk/ for examples.
|
||||
|
||||
Then, very importantly, you probably need to implement the actual loader
|
||||
(examples available in loader/)
|
||||
|
||||
Last step to have minimally usable port is to add support to grub-install to
|
||||
put GRUB in a place where firmware or platform will pick it up.
|
||||
|
||||
Next steps are: filling datetime.c, setjmp.S, network (net/drivers),
|
||||
video (video/), halt (lib/), reboot (lib/).
|
||||
|
||||
Please add your platform to Platform limitations and Supported kernels chapter
|
||||
in user documentation and mention any steps you skipped which result in reduced
|
||||
features or performance. Here is the quick checklist of features. Some of them
|
||||
are less important than others and skipping them is completely ok, just needs
|
||||
to be mentioned in user documentation.
|
||||
|
||||
Checklist:
|
||||
@itemize
|
||||
@item Is heap big enough?
|
||||
@item Which charset is supported by console?
|
||||
@item Does platform have disk driver?
|
||||
@item Do you have network card support?
|
||||
@item Are you able to retrieve datetime (with date)?
|
||||
@item Are you able to set datetime (with date)?
|
||||
@item Is serial supported?
|
||||
@item Do you have direct disk support?
|
||||
@item Do you have direct keyboard support?
|
||||
@item Do you have USB support?
|
||||
@item Do you support loading through network?
|
||||
@item Do you support loading from disk?
|
||||
@item Do you support chainloading?
|
||||
@item Do you support network chainloading?
|
||||
@item Does cpuid command supports checking all
|
||||
CPU features that the user might want conditionalise on
|
||||
(64-bit mode, hypervisor,...)
|
||||
@item Do you support hints? How reliable are they?
|
||||
@item Does platform have ACPI? If so do ``acpi'' and ``lsacpi'' modules work?
|
||||
@item Do any of platform-specific operations mentioned in the relevant section of
|
||||
user manual makes sense on your platform?
|
||||
@item Does your platform support PCI? If so is there an appropriate driver for
|
||||
GRUB?
|
||||
@item Do you support badram?
|
||||
@end itemize
|
||||
|
||||
@node Error Handling
|
||||
@chapter Error Handling
|
||||
|
||||
@ -1379,7 +1689,7 @@ right edges of two adjacent glyphs. The @strong{device width} field determines
|
||||
the effective leading value that is used to render the font.
|
||||
|
||||
@end itemize
|
||||
@image{font_char_metrics,,,,.png}
|
||||
@image{font_char_metrics,,,,png}
|
||||
|
||||
An illustration of how the various font metrics apply to characters.
|
||||
|
||||
|
@ -5,15 +5,22 @@
|
||||
# Boot automatically after 30 secs.
|
||||
set timeout=30
|
||||
|
||||
# By default, boot the first entry.
|
||||
set default=0
|
||||
# By default, boot the GNU/Linux
|
||||
set default=gnulinux
|
||||
|
||||
# Fallback to the second entry.
|
||||
set fallback=1
|
||||
# Fallback to GNU/Hurd.
|
||||
set fallback=gnuhurd
|
||||
|
||||
# For booting GNU/Linux
|
||||
menuentry "GNU/Linux" --id gnulinux {
|
||||
set root=(hd0,msdos1)
|
||||
linux /vmlinuz root=/dev/sda1
|
||||
initrd /initrd.img
|
||||
}
|
||||
|
||||
# For booting GNU/Hurd
|
||||
menuentry "GNU (aka GNU/Hurd)" {
|
||||
set root=(hd0,1)
|
||||
menuentry "GNU (aka GNU/Hurd)" --id gnuhurd {
|
||||
set root=(hd0,msdos1)
|
||||
multiboot /boot/gnumach.gz root=device:hd0s1
|
||||
module /hurd/ext2fs.static ext2fs --readonly \
|
||||
--multiboot-command-line='${kernel-command-line}' \
|
||||
@ -24,41 +31,35 @@ menuentry "GNU (aka GNU/Hurd)" {
|
||||
module /lib/ld.so.1 exec /hurd/exec '$(exec-task=task-create)'
|
||||
}
|
||||
|
||||
# For booting GNU/Linux
|
||||
menuentry "GNU/Linux" {
|
||||
set root=(hd0,1)
|
||||
linux /vmlinuz root=/dev/sda1
|
||||
initrd /initrd.img
|
||||
}
|
||||
|
||||
# For booting FreeBSD
|
||||
menuentry "FreeBSD (or GNU/kFreeBSD), direct boot" {
|
||||
set root=(hd0,1,a)
|
||||
set root=(hd0,msdos1,bsd1)
|
||||
kfreebsd /boot/kernel/kernel
|
||||
kfreebsd_loadenv /boot/device.hints
|
||||
kfreebsd_module /boot/splash.bmp type=splash_image_data
|
||||
set kFreeBSD.vfs.root.mountfrom=ufs:ad0s1a
|
||||
}
|
||||
|
||||
menuentry "FreeBSD (or GNU/kFreeBSD), via /boot/loader" {
|
||||
set root=(hd0,1,a)
|
||||
set root=(hd0,msdos1,bsd1)
|
||||
kfreebsd /boot/loader
|
||||
}
|
||||
|
||||
# For booting NetBSD
|
||||
menuentry "NetBSD" {
|
||||
set root=(hd0,1,a)
|
||||
set root=(hd0,netbsd1)
|
||||
knetbsd /netbsd
|
||||
}
|
||||
|
||||
# For booting OpenBSD
|
||||
menuentry "OpenBSD" {
|
||||
set root=(hd0,1,a)
|
||||
set root=(hd0,openbsd1)
|
||||
kopenbsd /bsd
|
||||
}
|
||||
|
||||
# For booting Microsoft Windows
|
||||
menuentry "Microsoft Windows" {
|
||||
set root=(hd0,1)
|
||||
set root=(hd0,msdos1)
|
||||
chainloader +1
|
||||
}
|
||||
|
||||
|
675
docs/grub.texi
675
docs/grub.texi
@ -20,7 +20,7 @@
|
||||
This manual is for GNU GRUB (version @value{VERSION},
|
||||
@value{UPDATED}).
|
||||
|
||||
Copyright @copyright{} 1999,2000,2001,2002,2004,2006,2008,2009,2010 Free Software Foundation, Inc.
|
||||
Copyright @copyright{} 1999,2000,2001,2002,2004,2006,2008,2009,2010,2011,2012 Free Software Foundation, Inc.
|
||||
|
||||
@quotation
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
@ -37,6 +37,7 @@ Invariant Sections.
|
||||
* grub-mkconfig: (grub)Invoking grub-mkconfig. Generate GRUB configuration
|
||||
* grub-mkpasswd-pbkdf2: (grub)Invoking grub-mkpasswd-pbkdf2.
|
||||
* grub-mkrescue: (grub)Invoking grub-mkrescue. Make a GRUB rescue image
|
||||
* grub-probe: (grub)Invoking grub-probe. Probe device information
|
||||
@end direntry
|
||||
|
||||
@setchapternewpage odd
|
||||
@ -89,7 +90,10 @@ This edition documents version @value{VERSION}.
|
||||
* Interface:: The menu and the command-line
|
||||
* Environment:: GRUB environment variables
|
||||
* Commands:: The list of available builtin commands
|
||||
* Internationalisation:: Topics relating to language support
|
||||
* Security:: Authentication and authorisation
|
||||
* Platform limitations:: The list of platform-specific limitations
|
||||
* Platform-specific operations:: Platform-specific operations
|
||||
* Supported kernels:: The list of supported kernels
|
||||
* Troubleshooting:: Error messages produced by GRUB
|
||||
* Invoking grub-install:: How to use the GRUB installer
|
||||
@ -97,6 +101,7 @@ This edition documents version @value{VERSION}.
|
||||
* Invoking grub-mkpasswd-pbkdf2::
|
||||
Generate GRUB password hashes
|
||||
* Invoking grub-mkrescue:: Make a GRUB rescue image
|
||||
* Invoking grub-probe:: Probe device information for GRUB
|
||||
* Obtaining and Building GRUB:: How to obtain and build GRUB
|
||||
* Reporting bugs:: Where you should send a bug report
|
||||
* Future:: Some future plans on GRUB
|
||||
@ -340,11 +345,17 @@ devices, partitions, and files in a directory depending on context.
|
||||
@item Support multiple filesystem types
|
||||
Support multiple filesystem types transparently, plus a useful explicit
|
||||
blocklist notation. The currently supported filesystem types are @dfn{Amiga
|
||||
Fast FileSystem (AFFS)}, @dfn{AtheOS fs}, @dfn{BeFS}, @dfn{cpio}, @dfn{Linux
|
||||
ext2/ext3/ext4}, @dfn{DOS FAT12/FAT16/FAT32}, @dfn{HFS}, @dfn{HFS+},
|
||||
@dfn{ISO9660}, @dfn{JFS}, @dfn{Minix fs}, @dfn{nilfs2}, @dfn{NTFS},
|
||||
@dfn{ReiserFS}, @dfn{Amiga Smart FileSystem (SFS)}, @dfn{tar}, @dfn{UDF},
|
||||
@dfn{BSD UFS/UFS2}, and @dfn{XFS}. @xref{Filesystem}, for more information.
|
||||
Fast FileSystem (AFFS)}, @dfn{AtheOS fs}, @dfn{BeFS},
|
||||
@dfn{BtrFS} (including raid0, raid1, raid10, gzip and lzo),
|
||||
@dfn{cpio} (little- and big-endian bin, odc and newc variants),
|
||||
@dfn{Linux ext2/ext3/ext4}, @dfn{DOS FAT12/FAT16/FAT32}, @dfn{exFAT}, @dfn{HFS},
|
||||
@dfn{HFS+}, @dfn{ISO9660} (including Joliet, Rock-ridge and multi-chunk files),
|
||||
@dfn{JFS}, @dfn{Minix fs} (versions 1, 2 and 3), @dfn{nilfs2},
|
||||
@dfn{NTFS} (including compression), @dfn{ReiserFS}, @dfn{ROMFS},
|
||||
@dfn{Amiga Smart FileSystem (SFS)}, @dfn{Squash4}, @dfn{tar}, @dfn{UDF},
|
||||
@dfn{BSD UFS/UFS2}, @dfn{XFS}, and @dfn{ZFS} (including lzjb, gzip,
|
||||
zle, mirror, stripe, raidz1/2/3 and encryption in AES-CCM and AES-GCM).
|
||||
@xref{Filesystem}, for more information.
|
||||
|
||||
@item Support automatic decompression
|
||||
Can decompress files which were compressed by @command{gzip} or
|
||||
@ -668,17 +679,12 @@ storage devices.
|
||||
@node Device map
|
||||
@section The map between BIOS drives and OS devices
|
||||
|
||||
The @command{grub-mkdevicemap} program can be used to create the @dfn{device
|
||||
map file}. It is often run automatically by tools such as
|
||||
@command{grub-install} if the device map file does not already exist. The
|
||||
file name @file{/boot/grub/device.map} is preferred.
|
||||
|
||||
If the device map file exists, the GRUB utilities (@command{grub-probe},
|
||||
@command{grub-setup}, etc.) read it to map BIOS drives to OS devices. This
|
||||
file consists of lines like this:
|
||||
|
||||
@example
|
||||
@var{device} @var{file}
|
||||
(@var{device}) @var{file}
|
||||
@end example
|
||||
|
||||
@var{device} is a drive specified in the GRUB syntax (@pxref{Device
|
||||
@ -702,11 +708,12 @@ custom menu entries you write. If the device map file does not exist, then
|
||||
the GRUB utilities will assume a temporary device map on the fly. This is
|
||||
often good enough, particularly in the common case of single-disk systems.
|
||||
|
||||
However, the device map file is not entirely obsolete yet, and there are
|
||||
still some situations that require it to exist. If necessary, you may edit
|
||||
the file if @command{grub-mkdevicemap} makes a mistake. You can put any
|
||||
comments in the file if needed, as the GRUB utilities assume that a line is
|
||||
just a comment if the first character is @samp{#}.
|
||||
However, the device map file is not entirely obsolete yet, and it is
|
||||
used for overriding when current environment is different from the one on boot.
|
||||
Most common case is if you use a partition or logical volume as a disk for
|
||||
virtual machine. You can put any comments in the file if needed,
|
||||
as the GRUB utilities assume that a line is just a comment if
|
||||
the first character is @samp{#}.
|
||||
|
||||
|
||||
@node BIOS installation
|
||||
@ -784,6 +791,7 @@ magic.
|
||||
|
||||
@menu
|
||||
* General boot methods:: How to boot OSes with GRUB generally
|
||||
* Loopback booting:: Notes on booting from loopbacks
|
||||
* OS-specific notes:: Notes on some operating systems
|
||||
@end menu
|
||||
|
||||
@ -855,6 +863,31 @@ required. @xref{DOS/Windows}.
|
||||
|
||||
Chain-loading is only supported on PC BIOS and EFI platforms.
|
||||
|
||||
@node Loopback booting
|
||||
@section Loopback booting
|
||||
GRUB is able to read from an image (be it one of CD or HDD) stored on
|
||||
any of its accessible storages (refer to @pxref{loopback} command).
|
||||
However the OS itself should be able to find its root. This usually
|
||||
involves running a userspace program running before the real root
|
||||
is discovered. This is achieved by GRUB loading a specially made
|
||||
small image and passing it as ramdisk to the kernel. This is achieved
|
||||
by commands @command{kfreebsd_module}, @command{knetbsd_module_elf},
|
||||
@command{kopenbsd_ramdisk}, @command{initrd} (@pxref{initrd}),
|
||||
@command{initrd16} (@pxref{initrd}), @command{multiboot_module},
|
||||
@command{multiboot2_module} or @command{xnu_ramdisk}
|
||||
depending on the loader. Note that for knetbsd the image must be put
|
||||
inside miniroot.kmod and the whole miniroot.kmod has to be loaded. In
|
||||
kopenbsd payload this is disabled by default. Aditionally behaviour of
|
||||
initial ramdisk depends on command line options. Several distributors provide
|
||||
the image for this purpose or it's integrated in their standard ramdisk and
|
||||
activated by special option. Consult your kernel and distribution manual for
|
||||
more details. Other loaders like appleloader, chainloader (BIOS, EFI, coreboot),
|
||||
freedos, ntldr and plan9 provide no possibility of loading initial ramdisk and
|
||||
as far as author is aware the payloads in question don't support either initial
|
||||
ramdisk or discovering loopback boot in other way and as such not bootable this
|
||||
way. Please consider alternative boot methods like copying all files
|
||||
from the image to actual partition. Consult your OS documentation for
|
||||
more details
|
||||
|
||||
@node OS-specific notes
|
||||
@section Some caveats on OS-specific issues
|
||||
@ -878,7 +911,7 @@ root partition to the kernel.
|
||||
@enumerate
|
||||
@item
|
||||
Set GRUB's root device to the same drive as GNU/Hurd's. The command
|
||||
@code{search --file --set /boot/gnumach.gz} or similar may help you
|
||||
@code{search --set=root --file /boot/gnumach.gz} or similar may help you
|
||||
(@pxref{search}).
|
||||
|
||||
@item
|
||||
@ -911,7 +944,7 @@ resembles to boot a Multiboot-compliant OS.
|
||||
@enumerate
|
||||
@item
|
||||
Set GRUB's root device to the same drive as GNU/Linux's. The command
|
||||
@code{search --file --set /vmlinuz} or similar may help you
|
||||
@code{search --set=root --file /vmlinuz} or similar may help you
|
||||
(@pxref{search}).
|
||||
|
||||
@item
|
||||
@ -1023,6 +1056,7 @@ need to write the whole thing by hand.
|
||||
@menu
|
||||
* Simple configuration:: Recommended for most users
|
||||
* Shell-like scripting:: For power users and developers
|
||||
* Multi-boot manual config:: For non-standard multi-OS scenarios
|
||||
* Embedded configuration:: Embedding a configuration file into GRUB
|
||||
@end menu
|
||||
|
||||
@ -1102,7 +1136,11 @@ indefinitely.
|
||||
|
||||
@item GRUB_HIDDEN_TIMEOUT
|
||||
Wait this many seconds for a key to be pressed before displaying the menu.
|
||||
If no key is pressed during that time, boot immediately. Unset by default.
|
||||
If no key is pressed during that time, display the menu for the number of
|
||||
seconds specified in GRUB_TIMEOUT before booting the default entry. We expect
|
||||
that most people who use GRUB_HIDDEN_TIMEOUT will want to have GRUB_TIMEOUT set
|
||||
to @samp{0} so that the menu is not displayed at all unless a key is pressed.
|
||||
Unset by default.
|
||||
|
||||
@item GRUB_HIDDEN_TIMEOUT_QUIET
|
||||
In conjunction with @samp{GRUB_HIDDEN_TIMEOUT}, set this to @samp{true} to
|
||||
@ -1167,10 +1205,19 @@ only to the default menu entry, after those listed in
|
||||
As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, but for
|
||||
NetBSD.
|
||||
|
||||
@item GRUB_CMDLINE_GNUMACH
|
||||
As @samp{GRUB_CMDLINE_LINUX}, but for GNU Mach.
|
||||
|
||||
@item GRUB_CMDLINE_XEN
|
||||
@itemx GRUB_CMDLINE_XEN_DEFAULT
|
||||
As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, but for
|
||||
Linux and Xen.
|
||||
The values of these options are appended to the values of
|
||||
@samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux
|
||||
and Xen menu entries.
|
||||
|
||||
@item GRUB_CMDLINE_LINUX_XEN_REPLACE
|
||||
@item GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT
|
||||
The values of these options replace the values of @samp{GRUB_CMDLINE_LINUX}
|
||||
and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux and Xen menu entries.
|
||||
|
||||
@item GRUB_DISABLE_LINUX_UUID
|
||||
Normally, @command{grub-mkconfig} will generate menu entries that use
|
||||
@ -1197,7 +1244,8 @@ listed in @file{/boot/grub/video.lst}.
|
||||
Set the resolution used on the @samp{gfxterm} graphical terminal. Note that
|
||||
you can only use modes which your graphics card supports via VESA BIOS
|
||||
Extensions (VBE), so for example native LCD panel resolutions may not be
|
||||
available. The default is @samp{640x480}. @xref{gfxmode}.
|
||||
available. The default is @samp{auto}, which tries to select a preferred
|
||||
resolution. @xref{gfxmode}.
|
||||
|
||||
@item GRUB_BACKGROUND
|
||||
Set a background image for use with the @samp{gfxterm} graphical terminal.
|
||||
@ -1394,7 +1442,7 @@ definitions do not affect the exit status in @code{$?}. When executed, the
|
||||
exit status of a function is the exit status of the last command executed in
|
||||
the body.
|
||||
|
||||
@item menuentry @var{title} [@option{--class=class} @dots{}] [@option{--users=users}] [@option{--hotkey=key}] @{ @var{command}; @dots{} @}
|
||||
@item menuentry @var{title} [@option{--class=class} @dots{}] [@option{--users=users}] [@option{--unrestricted}] [@option{--hotkey=key}] @{ @var{command}; @dots{} @}
|
||||
@xref{menuentry}.
|
||||
@end table
|
||||
|
||||
@ -1438,6 +1486,101 @@ than zero; otherwise 0.
|
||||
|
||||
@end table
|
||||
|
||||
@node Multi-boot manual config
|
||||
@section Multi-boot manual config
|
||||
|
||||
Currently autogenerating config files for multi-boot environments depends on
|
||||
os-prober and has several shortcomings. While fixing it is scheduled for the
|
||||
next release, meanwhile you can make use of the power of GRUB syntax and do it
|
||||
yourself. A possible configuration is detailed here, feel free to adjust to your
|
||||
needs.
|
||||
|
||||
First create a separate GRUB partition, big enough to hold GRUB. Some of the
|
||||
following entries show how to load OS installer images from this same partition,
|
||||
for that you obviously need to make the partition large enough to hold those
|
||||
images as well.
|
||||
Mount this partition on/mnt/boot and disable GRUB in all OSes and manually
|
||||
install self-compiled latest GRUB with:
|
||||
|
||||
@code{grub-install --boot-directory=/mnt/boot /dev/sda}
|
||||
|
||||
In all the OSes install GRUB tools but disable installing GRUB in bootsector,
|
||||
so you'll have menu.lst and grub.cfg available for use. Also disable os-prober
|
||||
use by setting:
|
||||
|
||||
@code{GRUB_DISABLE_OS_PROBER=true}
|
||||
|
||||
in /etc/default/grub
|
||||
|
||||
Then write a grub.cfg (/mnt/boot/grub/grub.cfg):
|
||||
|
||||
@example
|
||||
|
||||
menuentry "OS using grub2" @{
|
||||
insmod xfs
|
||||
search --set=root --label OS1 --hint hd0,msdos8
|
||||
configfile /boot/grub/grub.cfg
|
||||
@}
|
||||
|
||||
menuentry "OS using grub2-legacy" @{
|
||||
insmod ext2
|
||||
search --set=root --label OS2 --hint hd0,msdos6
|
||||
legacy_configfile /boot/grub/menu.lst
|
||||
@}
|
||||
|
||||
menuentry "Windows XP" @{
|
||||
insmod ntfs
|
||||
search --set=root --label WINDOWS_XP --hint hd0,msdos1
|
||||
ntldr /ntldr
|
||||
@}
|
||||
|
||||
menuentry "Windows 7" @{
|
||||
insmod ntfs
|
||||
search --set=root --label WINDOWS_7 --hint hd0,msdos2
|
||||
ntldr /bootmgr
|
||||
@}
|
||||
|
||||
menuentry "FreeBSD" @{
|
||||
insmod zfs
|
||||
search --set=root --label freepool --hint hd0,msdos7
|
||||
kfreebsd /freebsd@@/boot/kernel/kernel
|
||||
kfreebsd_module_elf /freebsd@@/boot/kernel/opensolaris.ko
|
||||
kfreebsd_module_elf /freebsd@@/boot/kernel/zfs.ko
|
||||
kfreebsd_module /freebsd@@/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache
|
||||
set kFreeBSD.vfs.root.mountfrom=zfs:freepool/freebsd
|
||||
set kFreeBSD.hw.psm.synaptics_support=1
|
||||
@}
|
||||
|
||||
menuentry "experimental GRUB" @{
|
||||
search --set=root --label GRUB --hint hd0,msdos5
|
||||
multiboot /experimental/grub/i386-pc/core.img
|
||||
@}
|
||||
|
||||
menuentry "Fedora 16 installer" @{
|
||||
search --set=root --label GRUB --hint hd0,msdos5
|
||||
linux /fedora/vmlinuz lang=en_US keymap=sg resolution=1280x800
|
||||
initrd /fedora/initrd.img
|
||||
@}
|
||||
|
||||
menuentry "Fedora rawhide installer" @{
|
||||
search --set=root --label GRUB --hint hd0,msdos5
|
||||
linux /fedora/vmlinuz repo=ftp://mirror.switch.ch/mirror/fedora/linux/development/rawhide/x86_64 lang=en_US keymap=sg resolution=1280x800
|
||||
initrd /fedora/initrd.img
|
||||
@}
|
||||
|
||||
menuentry "Debian sid installer" @{
|
||||
search --set=root --label GRUB --hint hd0,msdos5
|
||||
linux /debian/dists/sid/main/installer-amd64/current/images/hd-media/vmlinuz
|
||||
initrd /debian/dists/sid/main/installer-amd64/current/images/hd-media/initrd.gz
|
||||
@}
|
||||
|
||||
@end example
|
||||
|
||||
Notes:
|
||||
@itemize
|
||||
@item Argument to search after --label is FS LABEL. You can also use UUIDs with --fs-uuid UUID instead of --label LABEL. You could also use direct @code{root=hd0,msdosX} but this is not recommened due to device name instability.
|
||||
@end itemize
|
||||
|
||||
@node Embedded configuration
|
||||
@section Embedding a configuration file into GRUB
|
||||
|
||||
@ -1536,11 +1679,11 @@ fit on screen, do ``set pager=1'' before executing ``lsfonts''.
|
||||
@subsection Progress Bar
|
||||
|
||||
@float Figure, Pixmap-styled progress bar
|
||||
@c @image{Theme_progress_bar,,,,.png}
|
||||
@c @image{Theme_progress_bar,,,,png}
|
||||
@end float
|
||||
|
||||
@float Figure, Plain progress bar, drawn with solid color.
|
||||
@c @image{Theme_progress_bar_filled,,,,.png}
|
||||
@c @image{Theme_progress_bar_filled,,,,png}
|
||||
@end float
|
||||
|
||||
Progress bars are used to display the remaining time before GRUB boots the
|
||||
@ -1550,11 +1693,12 @@ the id ``__timeout__''. This indicates to GRUB that the progress bar should
|
||||
be updated as time passes, and it should be made invisible if the countdown to
|
||||
automatic boot is interrupted by the user.
|
||||
|
||||
Progress bars may optionally have text displayed on them. This is controlled
|
||||
through the ``show_text'' property, which can be set to either ``true'' or
|
||||
``false'' to control whether text is displayed. When GRUB is counting down to
|
||||
automatic boot, the text informs the user of the number of seconds remaining.
|
||||
|
||||
Progress bars may optionally have text displayed on them. This text is
|
||||
controlled by variable ``text'' which contains a printf template with the
|
||||
only argument %d is the number of seconds remaining. Additionally special
|
||||
values ``@@TIMEOUT_NOTIFICATION_SHORT@@'', ``@@TIMEOUT_NOTIFICATION_MIDDLE@@'',
|
||||
``@@TIMEOUT_NOTIFICATION_LONG@@'' are replaced with standard and translated
|
||||
templates.
|
||||
|
||||
@subsection Circular Progress Indicator
|
||||
|
||||
@ -1934,16 +2078,10 @@ The boot file name provided by DHCP. Read-only.
|
||||
The name of the DHCP server responsible for these boot parameters.
|
||||
Read-only.
|
||||
|
||||
@item pxe_blksize
|
||||
The PXE transfer block size. Read-write, defaults to 512.
|
||||
@item net_default_server
|
||||
The default server. Read-write, although setting this is only useful
|
||||
before opening a network device.
|
||||
|
||||
@item pxe_default_server
|
||||
The default PXE server. Read-write, although setting this is only useful
|
||||
before opening a PXE device.
|
||||
|
||||
@item pxe_default_gateway
|
||||
The default gateway to use when contacting the PXE server. Read-write,
|
||||
although setting this is only useful before opening a PXE device.
|
||||
@end table
|
||||
|
||||
|
||||
@ -2196,42 +2334,71 @@ you see the files in a device or use the command @command{search}
|
||||
The device syntax is like this:
|
||||
|
||||
@example
|
||||
@code{(@var{device}[,@var{part-num}][,@var{bsd-subpart-letter}])}
|
||||
@code{(@var{device}[,@var{partmap-name1}@var{part-num1}[,@var{partmap-name2}@var{part-num2}[,...]]])}
|
||||
@end example
|
||||
|
||||
@samp{[]} means the parameter is optional. @var{device} should be
|
||||
either @samp{fd} or @samp{hd} followed by a digit, like @samp{fd0}.
|
||||
But you can also set @var{device} to a hexadecimal or a decimal number
|
||||
which is a BIOS drive number, so the following are equivalent:
|
||||
@samp{[]} means the parameter is optional. @var{device} depends on the disk
|
||||
driver in use. BIOS and EFI disks use either @samp{fd} or @samp{hd} followed
|
||||
by a digit, like @samp{fd0}, or @samp{cd}.
|
||||
AHCI, PATA (ata), crypto, USB use the name of driver followed by a number.
|
||||
Memdisk and host are limited to one disk and so it's refered just by driver
|
||||
name.
|
||||
RAID (md), ofdisk (ieee1275 and nand), LVM (lv), LDM and arcdisk (arc) use
|
||||
intrinsic name of disk prefixed by driver name. Additionally just ``nand''
|
||||
refers to the disk aliased as ``nand''.
|
||||
Conflicts are solved by suffixing a number if necessarry.
|
||||
Commas need to be escaped.
|
||||
Loopback uses whatever name specified to @command{loopback} command.
|
||||
Hostdisk uses names specified in device.map as long as it's of the form
|
||||
[fhc]d[0-9]* or hostdisk/<OS DEVICE>.
|
||||
For crypto and RAID (md) additionally you can use the syntax
|
||||
<driver name>uuid/<uuid>.
|
||||
|
||||
@example
|
||||
(fd0)
|
||||
(hd0)
|
||||
(0x80)
|
||||
(128)
|
||||
(cd)
|
||||
(ahci0)
|
||||
(ata0)
|
||||
(crypto0)
|
||||
(usb0)
|
||||
(cryptouuid/123456789abcdef0123456789abcdef0)
|
||||
(mduuid/123456789abcdef0123456789abcdef0)
|
||||
(lv/system-root)
|
||||
(md/myraid)
|
||||
(md/0)
|
||||
(ieee1275/disk2)
|
||||
(ieee1275//pci@@1f\,0/ide@@d/disk@@2)
|
||||
(nand)
|
||||
(memdisk)
|
||||
(host)
|
||||
(myloop)
|
||||
(hostdisk//dev/sda)
|
||||
@end example
|
||||
|
||||
@var{part-num} represents the partition number of @var{device}, starting
|
||||
from one for primary partitions and from five for extended partitions,
|
||||
and @var{bsd-subpart-letter} represents the BSD disklabel subpartition,
|
||||
such as @samp{a} or @samp{e}.
|
||||
|
||||
A shortcut for specifying BSD subpartitions is
|
||||
@code{(@var{device},@var{bsd-subpart-letter})}, in this case, GRUB
|
||||
searches for the first PC partition containing a BSD disklabel, then
|
||||
finds the subpartition @var{bsd-subpart-letter}. Here is an example:
|
||||
|
||||
@example
|
||||
(hd0,a)
|
||||
@end example
|
||||
from one. @var{partname} is optional but is recommended since disk may have
|
||||
several top-level partmaps. Specifying third and later component you can access
|
||||
to subpartitions.
|
||||
|
||||
The syntax @samp{(hd0)} represents using the entire disk (or the
|
||||
MBR when installing GRUB), while the syntax @samp{(hd0,1)}
|
||||
represents using the first partition of the disk (or the boot sector
|
||||
of the partition when installing GRUB).
|
||||
|
||||
If you enabled the network support, the special drive @samp{(pxe)} is
|
||||
also available. Before using the network drive, you must initialize the
|
||||
network. @xref{Network}, for more information.
|
||||
@example
|
||||
(hd0,msdos1)
|
||||
(hd0,msdos1,msdos5)
|
||||
(hd0,msdos1,bsd3)
|
||||
(hd0,netbsd1)
|
||||
(hd0,gpt1)
|
||||
(hd0,1,3)
|
||||
@end example
|
||||
|
||||
If you enabled the network support, the special drives @samp{(tftp)},
|
||||
@samp{(http)} and so on ars also available.
|
||||
Before using the network drive, you must initialize the network.
|
||||
@xref{Network}, for more information.
|
||||
|
||||
If you boot GRUB from a CD-ROM, @samp{(cd)} is available. @xref{Making
|
||||
a GRUB bootable CD-ROM}, for details.
|
||||
@ -2887,7 +3054,7 @@ These commands can only be used in the menu:
|
||||
|
||||
@deffn Command menuentry @var{title} @
|
||||
[@option{--class=class} @dots{}] [@option{--users=users}] @
|
||||
[@option{--hotkey=key}] @
|
||||
[@option{--unrestricted}] [@option{--hotkey=key}] @
|
||||
@{ @var{command}; @dots{} @}
|
||||
This defines a GRUB menu entry named @var{title}. When this entry is
|
||||
selected from the menu, GRUB will set the @var{chosen} environment variable
|
||||
@ -2902,6 +3069,9 @@ different styles.
|
||||
The @option{--users} option grants specific users access to specific menu
|
||||
entries. @xref{Security}.
|
||||
|
||||
The @option{--unrestricted} option grants all users access to specific menu
|
||||
entries. @xref{Security}.
|
||||
|
||||
The @option{--hotkey} option associates a hotkey with a menu entry.
|
||||
@var{key} may be a single letter, or one of the aliases @samp{backspace},
|
||||
@samp{tab}, or @samp{delete}.
|
||||
@ -2913,7 +3083,7 @@ The @option{--hotkey} option associates a hotkey with a menu entry.
|
||||
|
||||
@deffn Command submenu @var{title} @
|
||||
[@option{--class=class} @dots{}] [@option{--users=users}] @
|
||||
[@option{--hotkey=key}] @
|
||||
[@option{--unrestricted}] [@option{--hotkey=key}] @
|
||||
@{ @var{menu entries} @dots{} @}
|
||||
This defines a submenu. An entry called @var{title} will be added to the
|
||||
menu; when that entry is selected, a new menu will be displayed showing all
|
||||
@ -3860,6 +4030,110 @@ Unset the environment variable @var{envvar}.
|
||||
|
||||
This command is not yet implemented for GRUB 2, although it is planned.
|
||||
|
||||
@node Internationalisation
|
||||
@chapter Charset
|
||||
GRUB uses UTF-8 internally other than in rendering where some GRUB-specific
|
||||
appropriate representation is used. All text files (including config) are
|
||||
assumed to be encoded in UTF-8.
|
||||
|
||||
@chapter Filesystems
|
||||
NTFS, JFS, UDF, HFS+, exFAT, long filenames in FAT, Joliet part of
|
||||
ISO9660 are treated as UTF-16 as per specification. AFS and BFS are read
|
||||
as UTF-8, again according to specification. BtrFS, cpio, tar, squash4, minix,
|
||||
minix2, minix3, ROMFS, ReiserFS, XFS, ext2, ext3, ext4, FAT (short names),
|
||||
RockRidge part of ISO9660, nilfs2, UFS1, UFS2 and ZFS are assumed
|
||||
to be UTF-8. This might be false on systems configured with legacy charset
|
||||
but as long as the charset used is superset of ASCII you should be able to
|
||||
access ASCII-named files. And it's recommended to configure your system to use
|
||||
UTF-8 to access the filesystem, convmv may help with migration. ISO9660 (plain)
|
||||
filenames are specified as being ASCII or being described with unspecified
|
||||
escape sequences. GRUB assumes that the ISO9660 names are UTF-8 (since
|
||||
any ASCII is valid UTF-8). There are some old CD-ROMs which use CP437
|
||||
in non-compliant way. You're still able to access files with names containing
|
||||
only ASCII characters on such filesystems though. You're also able to access
|
||||
any file if the filesystem contains valid Joliet (UTF-16) or RockRidge (UTF-8).
|
||||
AFFS, SFS and HFS never use unicode and GRUB assumes them to be in Latin1,
|
||||
Latin1 and MacRoman respectively. GRUB handles filesystem case-insensitivity
|
||||
however no attempt is performed at case conversion of international characters
|
||||
so e.g. a file named lowercase greek alpha is treated as different from
|
||||
the one named as uppercase alpha. The filesystems in questions are
|
||||
NTFS (except POSIX namespace), HFS+ (configurable at mkfs time, default
|
||||
insensitive), SFS (configurable at mkfs time, default insensitive),
|
||||
JFS (configurable at mkfs time, default sensitive), HFS, AFFS, FAT, exFAT
|
||||
and ZFS (configurable on per-subvolume basis by property ``casesensitivity'',
|
||||
default sensitive). On ZFS subvolumes marked as case insensitive files
|
||||
containing lowercase international characters are inaccessible.
|
||||
Also like all supported filesystems except HFS+ and ZFS (configurable on
|
||||
per-subvolume basis by property ``normalization'', default none) GRUB makes
|
||||
no attempt at check of canonical equivalence so a file name u-diaresis is
|
||||
treated as distinct from u+combining diaresis. This however means that in
|
||||
order to access file on HFS+ its name must be specified in normalisation form D.
|
||||
On normalized ZFS subvolumes filenames out of normalisation are inaccessible.
|
||||
|
||||
@chapter Output terminal
|
||||
Firmware output console ``console'' on ARC and IEEE1275 are limited to ASCII.
|
||||
BIOS firmware console and VGA text are limited to ASCII and some pseudographics.
|
||||
None of above mentioned is appropriate for displaying international and any
|
||||
unsupported character is replaced with question mark except pseudographics
|
||||
which we attempt to approximate with ASCII. EFI console on the other hand
|
||||
nominally supports UTF-16 but actual language coverage depends on firmware and
|
||||
may be very limited. The encoding used on serial can be chosen with
|
||||
@command{terminfo} as either ASCII, UTF-8 or ``visual UTF-8''. Last one is
|
||||
against the specification but results in correct rendering of right-to-left
|
||||
on some readers which don't have own bidi implementation. When using gfxterm
|
||||
or gfxmenu GRUB itself is responsible for rendering the text. In this case
|
||||
GRUB is limited by loaded fonts. If fonts contain all required characters
|
||||
then bidirectional text, cursive variants and combining marks other than
|
||||
enclosing, half (e.g. left half tilde or combining overline) and double ones.
|
||||
Ligatures aren't supported though. This should cover European, Middle Eastern
|
||||
(if you don't mind lack of lam-alif ligature in Arabic) and East Asian scripts.
|
||||
Notable unsupported scripts are Brahmic family and derived as well as
|
||||
Mongolian, Tifinagh, Korean Jamo (precomposed characters have no problem)
|
||||
and tonal writing (2e5-2e9). GRUB also ignores deprecated (as specified
|
||||
in Unicode) characters (e.g. tags). GRUB also doesn't handle so called
|
||||
``annotation characters'' If you can complete either of
|
||||
two lists or, better, propose a patch to improve rendering, please contact
|
||||
developper team.
|
||||
|
||||
@chapter Input terminal
|
||||
Firmware console on BIOS, IEEE1275 and ARC doesn't allow you to enter non-ASCII
|
||||
characters. EFI specification allows for such but author is unaware of any
|
||||
actual implementations. Serial input is currently limited for latin1 (unlikely
|
||||
to change). Own keyboard implementations (at_keyboard and usb_keyboard)
|
||||
supports any key but work on one-char-per-keystroke.
|
||||
So no dead keys or advanced input method. Also there is no keymap change hotkey.
|
||||
In practice it makes difficult to enter any text using non-Latin alphabet.
|
||||
Moreover all current input consumers are limited to ASCII.
|
||||
|
||||
@chapter Gettext
|
||||
GRUB supports being translated. For this you need to have language *.mo files in $prefix/locale, load gettext module and set ``lang'' variable.
|
||||
|
||||
@chapter Regexp
|
||||
Regexps work on unicode characters, however no attempt at checking cannonical
|
||||
equivalence has been made. Moreover the classes like [:alpha:] match only
|
||||
ASCII subset.
|
||||
|
||||
@chapter Other
|
||||
Currently GRUB always uses YEAR-MONTH-DAY HOUR:MINUTE:SECOND [WEEKDAY] 24-hour
|
||||
datetime format but weekdays are translated.
|
||||
GRUB always uses the decimal number format with [0-9] as digits and . as
|
||||
descimal separator and no group separator.
|
||||
IEEE1275 aliases are matched case-insensitively except non-ASCII which is
|
||||
matched as binary. Similar behaviour is for matching OSBundleRequired.
|
||||
Since IEEE1275 aliases and OSBundleRequired don't contain any non-ASCII it
|
||||
should never be a problem in practice.
|
||||
Case-sensitive identifiers are matched as raw strings, no canonical
|
||||
equivalence check is performed. Case-insenstive identifiers are matched
|
||||
as RAW but additionally [a-z] is equivalent to [A-Z]. GRUB-defined
|
||||
identifiers use only ASCII and so should user-defined ones.
|
||||
Identifiers containing non-ASCII may work but aren't supported.
|
||||
Only the ASCII space characters (space U+0020, tab U+000b, CR U+000d and
|
||||
LF U+000a) are recognised. Other unicode space characters aren't a valid
|
||||
field separator.
|
||||
@command{test} tests <, >, <=, >=, -pgt and -plt compare the strings in the
|
||||
lexicographical order of unicode codepoints, replicating the behaviour of
|
||||
test from coreutils.
|
||||
environment variables and commands are listed in the same order.
|
||||
|
||||
@node Security
|
||||
@chapter Authentication and authorisation
|
||||
@ -3892,8 +4166,10 @@ restricted to superusers.
|
||||
|
||||
Other users may be given access to 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{--users}
|
||||
option is not used for a menu entry, then that entry is unrestricted.
|
||||
@samp{menuentry} command (@pxref{menuentry}). If the @option{--unrestricted}
|
||||
option is used for a menu entry, then that entry is unrestricted.
|
||||
If the @option{--users} option is not used for a menu entry, then that
|
||||
only superusers are able to use it.
|
||||
|
||||
Putting this together, a typical @file{grub.cfg} fragment might look like
|
||||
this:
|
||||
@ -3904,7 +4180,7 @@ set superusers="root"
|
||||
password_pbkdf2 root grub.pbkdf2.sha512.10000.biglongstring
|
||||
password user1 insecure
|
||||
|
||||
menuentry "May be run by any user" @{
|
||||
menuentry "May be run by any user" --unrestricted @{
|
||||
set root=(hd0,1)
|
||||
linux /vmlinuz
|
||||
@}
|
||||
@ -3928,6 +4204,166 @@ adding @kbd{set superusers=} and @kbd{password} or @kbd{password_pbkdf2}
|
||||
commands.
|
||||
|
||||
|
||||
@node Platform limitations
|
||||
@chapter Platform limitations
|
||||
|
||||
GRUB2 is designed to be portable and is actually ported across platforms. We
|
||||
try to keep all platforms at the level. Unfortunately some platforms are better
|
||||
supported than others. This is detailed in current and 2 following sections.
|
||||
|
||||
ARC platform is unable to change datetime (firmware doesn't seem to provide a
|
||||
function for it).
|
||||
EMU has similar limitation.
|
||||
|
||||
ARC platform no serial port is available.
|
||||
EMU has similar limitation.
|
||||
|
||||
Console charset refers only to firmware-assisted console. gfxterm is always
|
||||
Unicode (see Internationalisation section for its limitations). Serial is
|
||||
configurable to UTF-8 or ASCII (see Internationalisation). In case of qemu
|
||||
and coreboot ports the refered console is vga_text. Loongson always uses
|
||||
gfxterm.
|
||||
|
||||
Most limited one is ASCII. CP437 provides additionally pseudographics.
|
||||
GRUB2 doesn't use any language characters from CP437 as often CP437 is replaced
|
||||
by national encoding compatible only in pseudographics.
|
||||
Unicode is the most versatile charset which supports many languages. However
|
||||
the actual console may be much more limited depending on firmware
|
||||
|
||||
On BIOS network is supported only if the image is loaded through network.
|
||||
On sparc64 GRUB is unable to determine which server it was booted from.
|
||||
|
||||
On platforms not having direct serial support (as indicated in the line serial)
|
||||
you can still redirect firmware console to serial if it allows so.
|
||||
|
||||
Direct ATA/AHCI support allows to circumvent various firmware limitations but
|
||||
isn't needed for normal operation except on baremetal ports.
|
||||
|
||||
AT keyboard support allows keyboard layout remapping and support for keys not
|
||||
available through firmware. It isn't needed for normal operation except
|
||||
baremetal ports.
|
||||
|
||||
USB support provides benefits similar to ATA (for USB disks) or AT (for USB
|
||||
keyboards). In addition it allows USBserial.
|
||||
|
||||
Chainloading refers to the ability to load another bootloader through the same protocol
|
||||
|
||||
Hints allow faster disk discovery by already knowing in advance which is the disk in
|
||||
question. On some platforms hints are correct unless you move the disk between boots.
|
||||
On other platforms it's just an educated guess.
|
||||
Note that hint failure results in just reduced performance, not a failure
|
||||
|
||||
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.
|
||||
|
||||
@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
|
||||
@item console charset @tab CP437 @tab CP437 @tab CP437 @tab CP437
|
||||
@item network @tab yes (*) @tab no @tab no @tab no
|
||||
@item ATA/AHCI @tab yes @tab yes @tab yes @tab yes
|
||||
@item AT keyboard @tab yes @tab yes @tab yes @tab yes
|
||||
@item USB @tab yes @tab yes @tab yes @tab yes
|
||||
@item chainloader @tab local @tab yes @tab yes @tab no
|
||||
@item cpuid @tab partial @tab partial @tab partial @tab partial
|
||||
@item hints @tab guess @tab guess @tab guess @tab guess
|
||||
@item PCI @tab yes @tab yes @tab yes @tab yes
|
||||
@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
|
||||
@end multitable
|
||||
|
||||
@multitable @columnfractions .20 .20 .20 .20 .20
|
||||
@item @tab ia32 EFI @tab amd64 EFI @tab ia32 IEEE1275 @tab Itanium
|
||||
@item video @tab yes @tab yes @tab no @tab no
|
||||
@item console charset @tab Unicode @tab Unicode @tab ASCII @tab Unicode
|
||||
@item network @tab yes @tab yes @tab yes @tab yes
|
||||
@item ATA/AHCI @tab yes @tab yes @tab yes @tab no
|
||||
@item AT keyboard @tab yes @tab yes @tab yes @tab no
|
||||
@item USB @tab yes @tab yes @tab yes @tab no
|
||||
@item chainloader @tab local @tab local @tab no @tab local
|
||||
@item cpuid @tab partial @tab partial @tab partial @tab no
|
||||
@item hints @tab guess @tab guess @tab good @tab guess
|
||||
@item PCI @tab yes @tab yes @tab yes @tab no
|
||||
@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
|
||||
@end multitable
|
||||
|
||||
@multitable @columnfractions .20 .20 .20 .20 .20
|
||||
@item @tab Loongson @tab sparc64 @tab Powerpc @tab ARC
|
||||
@item video @tab yes @tab no @tab yes @tab no
|
||||
@item console charset @tab N/A @tab ASCII @tab ASCII @tab ASCII
|
||||
@item network @tab no @tab yes (*) @tab yes @tab no
|
||||
@item ATA/AHCI @tab yes @tab no @tab no @tab no
|
||||
@item AT keyboard @tab yes @tab no @tab no @tab no
|
||||
@item USB @tab yes @tab no @tab no @tab no
|
||||
@item chainloader @tab yes @tab no @tab no @tab no
|
||||
@item cpuid @tab no @tab no @tab no @tab no
|
||||
@item hints @tab good @tab good @tab good @tab no
|
||||
@item PCI @tab yes @tab no @tab no @tab no
|
||||
@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
|
||||
@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 ASCII
|
||||
@item network @tab no @tab yes
|
||||
@item ATA/AHCI @tab yes @tab no
|
||||
@item AT keyboard @tab yes @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
|
||||
@end multitable
|
||||
|
||||
@node Platform-specific operations
|
||||
@chapter Outline
|
||||
|
||||
Some platforms have features which allows to implement
|
||||
some commands useless or not implementable on others.
|
||||
|
||||
Quick summary:
|
||||
|
||||
Information retrieval:
|
||||
|
||||
@itemize
|
||||
@item mipsel-loongson: lsspd
|
||||
@item mips-arc: lsdev
|
||||
@item efi: lsefisystab, lssal, lsefimmap
|
||||
@item i386-pc: lsapm
|
||||
@item acpi-enabled (i386-pc, i386-coreboot, i386-multiboot, *-efi): lsacpi
|
||||
@end itemize
|
||||
|
||||
Workarounds for platform-specific issues:
|
||||
@itemize
|
||||
@item i386-efi/x86_64-efi: loadbios, fixvideo
|
||||
@item acpi-enabled (i386-pc, i386-coreboot, i386-multiboot, *-efi):
|
||||
acpi (override ACPI tables)
|
||||
@item i386-pc: drivemap
|
||||
@item i386-pc: sendkey
|
||||
@end itemize
|
||||
|
||||
Advanced operations for power users:
|
||||
@itemize
|
||||
@item x86: iorw (direct access to I/O ports)
|
||||
@end itemize
|
||||
|
||||
Miscelaneous:
|
||||
@itemize
|
||||
@item cmos (x86-*, ieee1275, mips-qemu_mips, mips-loongson): cmostest
|
||||
(used on some laptops to check for special power-on key)
|
||||
@item i386-pc: play
|
||||
@end itemize
|
||||
|
||||
@node Supported kernels
|
||||
@chapter Supported boot targets
|
||||
|
||||
@ -3936,6 +4372,8 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel
|
||||
@item @tab BIOS @tab Coreboot
|
||||
@item BIOS chainloading @tab yes @tab no (1)
|
||||
@item NTLDR @tab yes @tab no (1)
|
||||
@item Plan9 @tab yes @tab no (1)
|
||||
@item Freedos @tab yes @tab no (1)
|
||||
@item FreeBSD bootloader @tab yes @tab crashes (1)
|
||||
@item 32-bit kFreeBSD @tab yes @tab crashes (2,6)
|
||||
@item 64-bit kFreeBSD @tab yes @tab crashes (2,6)
|
||||
@ -3960,6 +4398,8 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel
|
||||
@item @tab Multiboot @tab Qemu
|
||||
@item BIOS chainloading @tab no (1) @tab no (1)
|
||||
@item NTLDR @tab no (1) @tab no (1)
|
||||
@item Plan9 @tab no (1) @tab no (1)
|
||||
@item FreeDOS @tab no (1) @tab no (1)
|
||||
@item FreeBSD bootloader @tab crashes (1) @tab crashes (1)
|
||||
@item 32-bit kFreeBSD @tab crashes (6) @tab crashes (6)
|
||||
@item 64-bit kFreeBSD @tab crashes (6) @tab crashes (6)
|
||||
@ -3981,9 +4421,11 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel
|
||||
@end multitable
|
||||
|
||||
@multitable @columnfractions .50 .22 .22
|
||||
@item @tab 32-bit EFI @tab 64-bit EFI
|
||||
@item @tab ia32 EFI @tab amd64 EFI
|
||||
@item BIOS chainloading @tab no (1) @tab no (1)
|
||||
@item NTLDR @tab no (1) @tab no (1)
|
||||
@item Plan9 @tab no (1) @tab no (1)
|
||||
@item FreeDOS @tab no (1) @tab no (1)
|
||||
@item FreeBSD bootloader @tab crashes (1) @tab crashes (1)
|
||||
@item 32-bit kFreeBSD @tab headless @tab headless
|
||||
@item 64-bit kFreeBSD @tab headless @tab headless
|
||||
@ -4005,9 +4447,11 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel
|
||||
@end multitable
|
||||
|
||||
@multitable @columnfractions .50 .22 .22
|
||||
@item @tab IEEE1275
|
||||
@item @tab ia32 IEEE1275
|
||||
@item BIOS chainloading @tab no (1)
|
||||
@item NTLDR @tab no (1)
|
||||
@item Plan9 @tab no (1)
|
||||
@item FreeDOS @tab no (1)
|
||||
@item FreeBSD bootloader @tab crashes (1)
|
||||
@item 32-bit kFreeBSD @tab crashes (6)
|
||||
@item 64-bit kFreeBSD @tab crashes (6)
|
||||
@ -4037,7 +4481,8 @@ X86 support is summarised in the following table. ``Yes'' means that the kernel
|
||||
@item Requires ACPI
|
||||
@end enumerate
|
||||
|
||||
PowerPC and Sparc ports support only Linux. MIPS port supports Linux and multiboot2.
|
||||
PowerPC, IA64 and Sparc64 ports support only Linux. MIPS port supports Linux
|
||||
and multiboot2.
|
||||
|
||||
@chapter Boot tests
|
||||
|
||||
@ -4308,6 +4753,92 @@ built-in default.
|
||||
@end table
|
||||
|
||||
|
||||
@node Invoking grub-probe
|
||||
@chapter Invoking grub-probe
|
||||
|
||||
The program @command{grub-probe} probes device information for a given path
|
||||
or device.
|
||||
|
||||
@example
|
||||
grub-probe --target=fs /boot/grub
|
||||
grub-probe --target=drive --device /dev/sda1
|
||||
@end example
|
||||
|
||||
@command{grub-probe} must be given a path or device as a non-option
|
||||
argument, and also accepts the following options:
|
||||
|
||||
@table @option
|
||||
@item --help
|
||||
Print a summary of the command-line options and exit.
|
||||
|
||||
@item --version
|
||||
Print the version number of GRUB and exit.
|
||||
|
||||
@item -d
|
||||
@itemx --device
|
||||
If this option is given, then the non-option argument is a system device
|
||||
name (such as @samp{/dev/sda1}), and @command{grub-probe} will print
|
||||
information about that device. If it is not given, then the non-option
|
||||
argument is a filesystem path (such as @samp{/boot/grub}), and
|
||||
@command{grub-probe} will print information about the device containing that
|
||||
part of the filesystem.
|
||||
|
||||
@item -m @var{file}
|
||||
@itemx --device-map=@var{file}
|
||||
Use @var{file} as the device map (@pxref{Device map}) rather than the
|
||||
default, usually @samp{/boot/grub/device.map}.
|
||||
|
||||
@item -t @var{target}
|
||||
@itemx --target=@var{target}
|
||||
Print information about the given path or device as defined by @var{target}.
|
||||
The available targets and their meanings are:
|
||||
|
||||
@table @samp
|
||||
@item fs
|
||||
GRUB filesystem module.
|
||||
@item fs_uuid
|
||||
Filesystem Universally Unique Identifier (UUID).
|
||||
@item fs_label
|
||||
Filesystem label.
|
||||
@item drive
|
||||
GRUB device name.
|
||||
@item device
|
||||
System device name.
|
||||
@item partmap
|
||||
GRUB partition map module.
|
||||
@item abstraction
|
||||
GRUB abstraction module (e.g. @samp{lvm}).
|
||||
@item cryptodisk_uuid
|
||||
Crypto device UUID.
|
||||
@item msdos_parttype
|
||||
MBR partition type code (two hexadecimal digits).
|
||||
@item hints_string
|
||||
A string of platform search hints suitable for passing to the
|
||||
@command{search} command (@pxref{search}).
|
||||
@item bios_hints
|
||||
Search hints for the PC BIOS platform.
|
||||
@item ieee1275_hints
|
||||
Search hints for the IEEE1275 platform.
|
||||
@item baremetal_hints
|
||||
Search hints for platforms where disks are addressed directly rather than
|
||||
via firmware.
|
||||
@item efi_hints
|
||||
Search hints for the EFI platform.
|
||||
@item arc_hints
|
||||
Search hints for the ARC platform.
|
||||
@item compatibility_hint
|
||||
A guess at a reasonable GRUB drive name for this device, which may be
|
||||
used as a fallback if the @command{search} command fails.
|
||||
@item disk
|
||||
System device name for the whole disk.
|
||||
@end table
|
||||
|
||||
@item -v
|
||||
@itemx --verbose
|
||||
Print verbose messages.
|
||||
@end table
|
||||
|
||||
|
||||
@node Obtaining and Building GRUB
|
||||
@appendix How to obtain and build GRUB
|
||||
|
||||
@ -4320,11 +4851,11 @@ how to get the latest version.
|
||||
@end quotation
|
||||
|
||||
GRUB is available from the GNU alpha archive site
|
||||
@uref{ftp://alpha.gnu.org/gnu/grub} or any of its mirrors. The file
|
||||
@uref{ftp://ftp.gnu.org/gnu/grub} or any of its mirrors. The file
|
||||
will be named grub-version.tar.gz. The current version is
|
||||
@value{VERSION}, so the file you should grab is:
|
||||
|
||||
@uref{ftp://alpha.gnu.org/gnu/grub/grub-@value{VERSION}.tar.gz}
|
||||
@uref{ftp://ftp.gnu.org/gnu/grub/grub-@value{VERSION}.tar.gz}
|
||||
|
||||
To unbundle GRUB use the instruction:
|
||||
|
||||
|
@ -1,2 +0,0 @@
|
||||
[NAME]
|
||||
grub-bin2h \- convert a binary file to a C header
|
10
docs/man/grub-kbdcomp.h2m
Normal file
10
docs/man/grub-kbdcomp.h2m
Normal file
@ -0,0 +1,10 @@
|
||||
[NAME]
|
||||
grub-kbdcomp \- generate a GRUB keyboard layout file
|
||||
[DESCRIPTION]
|
||||
grub-kbdcomp processes a X keyboard layout description in
|
||||
.BR keymaps (5)
|
||||
format into a format that can be used by GRUB's
|
||||
.B keymap
|
||||
command.
|
||||
[SEE ALSO]
|
||||
.BR grub-mklayout (8)
|
@ -1,4 +1,10 @@
|
||||
[NAME]
|
||||
grub-mklayout \- generate a GRUB keyboard layout file
|
||||
[DESCRIPTION]
|
||||
grub-mklayout processes a keyboard layout description in
|
||||
.BR keymaps (5)
|
||||
format into a format that can be used by GRUB's
|
||||
.B keymap
|
||||
command.
|
||||
[SEE ALSO]
|
||||
.BR grub-mkconfig (8)
|
||||
|
4
docs/man/grub-mkstandalone.h2m
Normal file
4
docs/man/grub-mkstandalone.h2m
Normal file
@ -0,0 +1,4 @@
|
||||
[NAME]
|
||||
grub-mkstandalone \- make a memdisk-based GRUB image
|
||||
[SEE ALSO]
|
||||
.BR grub-mkimage (1)
|
2
docs/man/grub-mount.h2m
Normal file
2
docs/man/grub-mount.h2m
Normal file
@ -0,0 +1,2 @@
|
||||
[NAME]
|
||||
grub-mount \- export GRUB filesystem with FUSE
|
6
docs/man/grub-sparc64-setup.h2m
Normal file
6
docs/man/grub-sparc64-setup.h2m
Normal file
@ -0,0 +1,6 @@
|
||||
[NAME]
|
||||
grub-setup \- set up a device to boot using GRUB
|
||||
[SEE ALSO]
|
||||
.BR grub-install (8),
|
||||
.BR grub-mkimage (1),
|
||||
.BR grub-mkrescue (1)
|
190
gentpl.py
190
gentpl.py
@ -1,4 +1,19 @@
|
||||
#! /usr/bin/python
|
||||
# GRUB -- GRand Unified Bootloader
|
||||
# Copyright (C) 2010,2011 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/>.
|
||||
|
||||
#
|
||||
# This is the python script used to generate Makefile.tpl
|
||||
@ -6,8 +21,9 @@
|
||||
|
||||
GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
|
||||
"i386_multiboot", "i386_ieee1275", "x86_64_efi",
|
||||
"mips_yeeloong", "sparc64_ieee1275",
|
||||
"powerpc_ieee1275" ]
|
||||
"mips_loongson", "sparc64_ieee1275",
|
||||
"powerpc_ieee1275", "mips_arc", "ia64_efi",
|
||||
"mips_qemu_mips" ]
|
||||
|
||||
GROUPS = {}
|
||||
|
||||
@ -17,34 +33,35 @@ GROUPS["common"] = GRUB_PLATFORMS[:]
|
||||
GROUPS["i386"] = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275" ]
|
||||
GROUPS["x86_64"] = [ "x86_64_efi" ]
|
||||
GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"]
|
||||
GROUPS["mips"] = [ "mips_yeeloong" ]
|
||||
GROUPS["mips"] = [ "mips_loongson", "mips_qemu_mips", "mips_arc" ]
|
||||
GROUPS["sparc64"] = [ "sparc64_ieee1275" ]
|
||||
GROUPS["powerpc"] = [ "powerpc_ieee1275" ]
|
||||
|
||||
# Groups based on firmware
|
||||
GROUPS["x86_efi"] = [ "i386_efi", "x86_64_efi" ]
|
||||
GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "ia64_efi" ]
|
||||
GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ]
|
||||
|
||||
# emu is a special case so many core functionality isn't needed on this platform
|
||||
GROUPS["noemu"] = GRUB_PLATFORMS[:]; GROUPS["noemu"].remove("emu")
|
||||
|
||||
# Groups based on hardware features
|
||||
GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_yeeloong"]; GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi")
|
||||
GROUPS["pci"] = GROUPS["x86"] + GROUPS["mips"]
|
||||
GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_loongson", "mips_qemu_mips",
|
||||
"sparc64_ieee1275", "powerpc_ieee1275"]
|
||||
GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi")
|
||||
GROUPS["pci"] = GROUPS["x86"] + ["mips_loongson"]
|
||||
GROUPS["usb"] = GROUPS["pci"]
|
||||
|
||||
# If gfxterm is main output console integrate it into kernel
|
||||
GROUPS["videoinkernel"] = ["mips_yeeloong"]
|
||||
GROUPS["videoinkernel"] = ["mips_loongson", "mips_qemu_mips"]
|
||||
GROUPS["videomodules"] = GRUB_PLATFORMS[:];
|
||||
for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i)
|
||||
|
||||
# Similar for terminfo
|
||||
GROUPS["terminfoinkernel"] = ["mips_yeeloong"] + GROUPS["ieee1275"];
|
||||
GROUPS["terminfoinkernel"] = ["mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["ieee1275"];
|
||||
GROUPS["terminfomodule"] = GRUB_PLATFORMS[:];
|
||||
for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)
|
||||
|
||||
# Miscelaneous groups schedulded to disappear in future
|
||||
GROUPS["nosparc64"] = GRUB_PLATFORMS[:]; GROUPS["nosparc64"].remove("sparc64_ieee1275")
|
||||
GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"]
|
||||
GROUPS["nopc"] = GRUB_PLATFORMS[:]; GROUPS["nopc"].remove("i386_pc")
|
||||
|
||||
@ -180,6 +197,17 @@ def foreach_platform_specific_value(platform, suffix, nonetag, closure):
|
||||
r += "[+ ELSE +][+ FOR " + nonetag + " +]" + closure("[+ ." + nonetag + " +]") + "[+ ENDFOR +][+ ENDIF +]"
|
||||
return r
|
||||
|
||||
#
|
||||
# Returns autogen code that defines an autogen macro using the
|
||||
# definition given in the 'snippet'.
|
||||
#
|
||||
def define_autogen_macro(name, snippet):
|
||||
r = ""
|
||||
r += "[+ DEFINE " + name + " +]"
|
||||
r += snippet
|
||||
r += "[+ ENDDEF +]\n"
|
||||
return r
|
||||
|
||||
#
|
||||
# Template for handling values from sum of all groups for a platform,
|
||||
# for example:
|
||||
@ -238,14 +266,22 @@ def foreach_enabled_platform(closure):
|
||||
# noemu = bus/usb/usbhub.c;
|
||||
# enable = emu;
|
||||
# enable = i386;
|
||||
# enable = mips_yeeloong;
|
||||
# enable = mips_loongson;
|
||||
# emu_condition = COND_GRUB_EMU_USB;
|
||||
# };
|
||||
#
|
||||
def define_macro_for_platform_conditionals_if_statement(p):
|
||||
return define_autogen_macro(
|
||||
"if_" + p + "_conditionals",
|
||||
foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "if " + cond + "\n"))
|
||||
def define_macro_for_platform_conditionals_endif_statement(p):
|
||||
return define_autogen_macro(
|
||||
"endif_" + p + "_conditionals",
|
||||
foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "endif " + cond + "\n"))
|
||||
def under_platform_specific_conditionals(platform, snippet):
|
||||
r = foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "if " + cond + "\n")
|
||||
r = "[+ if_" + platform + "_conditionals +]"
|
||||
r += snippet
|
||||
r += foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "endif " + cond + "\n")
|
||||
r += "[+ endif_" + platform + "_conditionals +]"
|
||||
return r
|
||||
|
||||
def platform_specific_values(platform, suffix, nonetag):
|
||||
@ -258,18 +294,69 @@ def platform_values(platform, suffix):
|
||||
def extra_dist():
|
||||
return foreach_value("extra_dist", lambda value: value + " ")
|
||||
|
||||
def platform_sources(p): return platform_values(p, "")
|
||||
def platform_nodist_sources(p): return platform_values(p, "_nodist")
|
||||
def platform_dependencies(p): return platform_values(p, "dependencies", "_dependencies")
|
||||
def define_macro_for_platform_sources(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_sources",
|
||||
platform_values(p, ""))
|
||||
def define_macro_for_platform_nodist_sources(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_nodist_sources",
|
||||
platform_values(p, "_nodist"))
|
||||
def define_macro_for_platform_dependencies(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_dependencies",
|
||||
platform_values(p, "dependencies", "_dependencies"))
|
||||
def platform_sources(p): return "[+ get_" + p + "_sources +]"
|
||||
def platform_nodist_sources(p): return "[+ get_" + p + "_nodist_sources +]"
|
||||
def platform_dependencies(p): return "[+ get_" + p + "_dependencies +]"
|
||||
|
||||
def platform_startup(p): return platform_specific_values(p, "_startup", "startup")
|
||||
def platform_ldadd(p): return platform_specific_values(p, "_ldadd", "ldadd")
|
||||
def platform_cflags(p): return platform_specific_values(p, "_cflags", "cflags")
|
||||
def platform_ldflags(p): return platform_specific_values(p, "_ldflags", "ldflags")
|
||||
def platform_cppflags(p): return platform_specific_values(p, "_cppflags", "cppflags")
|
||||
def platform_ccasflags(p): return platform_specific_values(p, "_ccasflags", "ccasflags")
|
||||
def platform_stripflags(p): return platform_specific_values(p, "_stripflags", "stripflags")
|
||||
def platform_objcopyflags(p): return platform_specific_values(p, "_objcopyflags", "objcopyflags")
|
||||
#
|
||||
# Returns Autogen code which defines the autogen macros that collect
|
||||
# platform specific values for cflags, ldflags, etc. tags.
|
||||
#
|
||||
def define_macro_for_platform_startup(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_startup",
|
||||
platform_specific_values(p, "_startup", "startup"))
|
||||
def define_macro_for_platform_cflags(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_cflags",
|
||||
platform_specific_values(p, "_cflags", "cflags"))
|
||||
def define_macro_for_platform_ldadd(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_ldadd",
|
||||
platform_specific_values(p, "_ldadd", "ldadd"))
|
||||
def define_macro_for_platform_ldflags(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_ldflags",
|
||||
platform_specific_values(p, "_ldflags", "ldflags"))
|
||||
def define_macro_for_platform_cppflags(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_cppflags",
|
||||
platform_specific_values(p, "_cppflags", "cppflags"))
|
||||
def define_macro_for_platform_ccasflags(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_ccasflags",
|
||||
platform_specific_values(p, "_ccasflags", "ccasflags"))
|
||||
def define_macro_for_platform_stripflags(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_stripflags",
|
||||
platform_specific_values(p, "_stripflags", "stripflags"))
|
||||
def define_macro_for_platform_objcopyflags(p):
|
||||
return define_autogen_macro(
|
||||
"get_" + p + "_objcopyflags",
|
||||
platform_specific_values(p, "_objcopyflags", "objcopyflags"))
|
||||
#
|
||||
# Autogen calls to invoke the above macros.
|
||||
#
|
||||
def platform_startup(p): return "[+ get_" + p + "_startup +]"
|
||||
def platform_ldadd(p): return "[+ get_" + p + "_ldadd +]"
|
||||
def platform_cflags(p): return "[+ get_" + p + "_cflags +]"
|
||||
def platform_ldflags(p): return "[+ get_" + p + "_ldflags +]"
|
||||
def platform_cppflags(p): return "[+ get_" + p + "_cppflags +]"
|
||||
def platform_ccasflags(p): return "[+ get_" + p + "_ccasflags +]"
|
||||
def platform_stripflags(p): return "[+ get_" + p + "_stripflags +]"
|
||||
def platform_objcopyflags(p): return "[+ get_" + p + "_objcopyflags +]"
|
||||
|
||||
#
|
||||
# Emit snippet only the first time through for the current name.
|
||||
@ -283,7 +370,7 @@ def first_time(snippet):
|
||||
def module(platform):
|
||||
r = set_canonical_name_suffix(".module")
|
||||
|
||||
r += gvar_add("noinst_PROGRAMS", "[+ name +].module")
|
||||
r += gvar_add("platform_PROGRAMS", "[+ name +].module")
|
||||
r += gvar_add("MODULE_FILES", "[+ name +].module$(EXEEXT)")
|
||||
|
||||
r += var_set(cname() + "_SOURCES", platform_sources(platform) + " ## platform sources")
|
||||
@ -311,7 +398,7 @@ def module(platform):
|
||||
|
||||
def kernel(platform):
|
||||
r = set_canonical_name_suffix(".exec")
|
||||
r += gvar_add("noinst_PROGRAMS", "[+ name +].exec")
|
||||
r += gvar_add("platform_PROGRAMS", "[+ name +].exec")
|
||||
r += var_set(cname() + "_SOURCES", platform_startup(platform))
|
||||
r += var_add(cname() + "_SOURCES", platform_sources(platform))
|
||||
r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + " ## platform nodist sources")
|
||||
@ -330,13 +417,22 @@ def kernel(platform):
|
||||
r += gvar_add("platform_DATA", "[+ name +].img")
|
||||
r += gvar_add("CLEANFILES", "[+ name +].img")
|
||||
r += rule("[+ name +].img", "[+ name +].exec$(EXEEXT)",
|
||||
if_platform_tagged(platform, "nostrip", "cp $< $@",
|
||||
"$(STRIP) $(" + cname() + "_STRIPFLAGS) -o $@ $<"))
|
||||
if_platform_tagged(platform, "nostrip",
|
||||
"""if test x$(USE_APPLE_CC_FIXES) = xyes; then \
|
||||
$(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -ed2022 -wd1106 -nu -nd $< $@; \
|
||||
elif test ! -z '$(TARGET_OBJ2ELF)'; then \
|
||||
cp $< $@.bin; $(TARGET_OBJ2ELF) $@.bin && cp $@.bin $@ || (rm -f $@.bin; exit 1); \
|
||||
else cp $< $@; fi""",
|
||||
"""if test x$(USE_APPLE_CC_FIXES) = xyes; then \
|
||||
$(STRIP) $(""" + cname() + """) -o $@.bin $<; \
|
||||
$(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -ed2022 -wd1106 -nu -nd $@.bin $@; \
|
||||
else """ + "$(STRIP) $(" + cname() + "_STRIPFLAGS) -o $@ $<; \
|
||||
fi"""))
|
||||
return r
|
||||
|
||||
def image(platform):
|
||||
r = set_canonical_name_suffix(".image")
|
||||
r += gvar_add("noinst_PROGRAMS", "[+ name +].image")
|
||||
r += gvar_add("platform_PROGRAMS", "[+ name +].image")
|
||||
r += var_set(cname() + "_SOURCES", platform_sources(platform))
|
||||
r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform) + "## platform nodist sources")
|
||||
r += var_set(cname() + "_LDADD", platform_ldadd(platform))
|
||||
@ -357,7 +453,7 @@ def image(platform):
|
||||
if test x$(USE_APPLE_CC_FIXES) = xyes; then \
|
||||
$(MACHO2IMG) $< $@; \
|
||||
else \
|
||||
$(OBJCOPY) $(""" + cname() + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@; \
|
||||
$(OBJCOPY) $(""" + cname() + """_OBJCOPYFLAGS) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@; \
|
||||
fi
|
||||
""")
|
||||
return r
|
||||
@ -393,7 +489,7 @@ def manpage():
|
||||
r += gvar_add("man_MANS", "[+ name +].[+ mansection +]\n")
|
||||
r += rule("[+ name +].[+ mansection +]", "[+ name +]", """
|
||||
chmod a+x [+ name +]
|
||||
PATH=$(builddir):$$PATH $(HELP2MAN) --section=[+ mansection +] -i $(top_srcdir)/docs/man/[+ name +].h2m -o $@ [+ name +]
|
||||
PATH=$(builddir):$$PATH pkgdatadir=$(builddir) $(HELP2MAN) --section=[+ mansection +] -i $(top_srcdir)/docs/man/[+ name +].h2m -o $@ [+ name +]
|
||||
""")
|
||||
r += gvar_add("CLEANFILES", "[+ name +].[+ mansection +]")
|
||||
r += "endif\n"
|
||||
@ -440,7 +536,7 @@ def script(platform):
|
||||
r += "[+ ENDIF +]"
|
||||
|
||||
r += rule("[+ name +]", platform_sources(platform) + " $(top_builddir)/config.status", """
|
||||
$(top_builddir)/config.status --file=-:$< | sed -e 's,@pkglib_DATA@,$(pkglib_DATA),g' > $@
|
||||
$(top_builddir)/config.status --file=$@:$<
|
||||
chmod a+x [+ name +]
|
||||
""")
|
||||
|
||||
@ -486,7 +582,6 @@ def script_rules():
|
||||
def data_rules():
|
||||
return rules("data", data)
|
||||
|
||||
print "[+ AutoGen5 template +]\n"
|
||||
a = module_rules()
|
||||
b = kernel_rules()
|
||||
c = image_rules()
|
||||
@ -496,11 +591,28 @@ f = script_rules()
|
||||
g = data_rules()
|
||||
z = global_variable_initializers()
|
||||
|
||||
print ("[+ AutoGen5 template +]\n")
|
||||
for p in GRUB_PLATFORMS:
|
||||
print (define_macro_for_platform_sources(p))
|
||||
print (define_macro_for_platform_nodist_sources(p))
|
||||
# print define_macro_for_platform_dependencies(p)
|
||||
|
||||
print (define_macro_for_platform_startup(p))
|
||||
print (define_macro_for_platform_cflags(p))
|
||||
print (define_macro_for_platform_ldadd(p))
|
||||
print (define_macro_for_platform_ldflags(p))
|
||||
print (define_macro_for_platform_cppflags(p))
|
||||
print (define_macro_for_platform_ccasflags(p))
|
||||
print (define_macro_for_platform_stripflags(p))
|
||||
print (define_macro_for_platform_objcopyflags(p))
|
||||
|
||||
print (define_macro_for_platform_conditionals_if_statement(p))
|
||||
print (define_macro_for_platform_conditionals_endif_statement(p))
|
||||
# print z # initializer for all vars
|
||||
print a
|
||||
print b
|
||||
print c
|
||||
print d
|
||||
print e
|
||||
print f
|
||||
print g
|
||||
print (a)
|
||||
print (b)
|
||||
print (c)
|
||||
print (d)
|
||||
print (e)
|
||||
print (f)
|
||||
print (g)
|
||||
|
@ -1,4 +1,4 @@
|
||||
AUTOMAKE_OPTIONS = subdir-objects
|
||||
AUTOMAKE_OPTIONS = subdir-objects -Wno-portability
|
||||
|
||||
DEPDIR=.deps-core
|
||||
|
||||
@ -14,6 +14,8 @@ TARGET_CFLAGS += -DUSE_ASCII_FAILBACK=1 -DHAVE_UNIFONT_WIDTHSPEC=1
|
||||
endif
|
||||
endif
|
||||
|
||||
MACHO2IMG=$(top_builddir)/grub-macho2img
|
||||
|
||||
AM_CFLAGS = $(TARGET_CFLAGS)
|
||||
AM_LDFLAGS = $(TARGET_LDFLAGS)
|
||||
AM_CPPFLAGS = $(TARGET_CPPFLAGS) $(CPPFLAGS_DEFAULT)
|
||||
@ -38,6 +40,15 @@ trigtables.c: gentrigtables gentrigtables.c $(top_srcdir)/configure.ac
|
||||
$(builddir)/gentrigtables > $@
|
||||
CLEANFILES += trigtables.c
|
||||
|
||||
gensm712: video/sm712.c
|
||||
$(BUILD_CC) -DGENINIT -o $@ -I$(top_builddir) -I$(top_builddir)/include -I$(top_srcdir)/include $(CPPFLAGS) $<
|
||||
CLEANFILES += gensm712
|
||||
|
||||
# trigtables.c
|
||||
sm712_start.S: gensm712 video/sm712.c $(top_srcdir)/configure.ac
|
||||
$(builddir)/gensm712 > $@
|
||||
CLEANFILES += sm712_start.S
|
||||
|
||||
# XXX Use Automake's LEX & YACC support
|
||||
grub_script.tab.h: script/parser.y
|
||||
$(YACC) -d -p grub_script_yy -b grub_script $<
|
||||
@ -50,9 +61,10 @@ grub_script.yy.h: script/yylex.l
|
||||
grub_script.yy.c: grub_script.yy.h
|
||||
|
||||
rs_decoder.S: $(srcdir)/lib/reed_solomon.c
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Os -I$(top_builddir) -S -DSTANDALONE -o $@ $< -g0 -mregparm=3
|
||||
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Os -I$(top_builddir) -S -DSTANDALONE -o $@ $< -g0 -mregparm=3 -ffreestanding
|
||||
|
||||
kern/i386/pc/startup.S: $(builddir)/rs_decoder.S
|
||||
boot/mips/loongson/fwstart.S: $(builddir)/sm712_start.S
|
||||
|
||||
CLEANFILES += grub_script.yy.c grub_script.yy.h
|
||||
|
||||
@ -78,12 +90,11 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/partition.h
|
||||
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/boot.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h
|
||||
|
||||
if COND_i386_pc
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pxe.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h
|
||||
@ -92,17 +103,19 @@ endif
|
||||
|
||||
if COND_i386_efi
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
|
||||
endif
|
||||
|
||||
if COND_i386_coreboot
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/i386/pc/int.h
|
||||
endif
|
||||
|
||||
if COND_i386_multiboot
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/i386/pc/int.h
|
||||
endif
|
||||
|
||||
if COND_i386_qemu
|
||||
@ -120,12 +133,26 @@ endif
|
||||
|
||||
if COND_x86_64_efi
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
|
||||
endif
|
||||
|
||||
if COND_mips_yeeloong
|
||||
if COND_ia64_efi
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||
endif
|
||||
|
||||
if COND_mips
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/kernel.h
|
||||
endif
|
||||
|
||||
if COND_mips_arc
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arc/arc.h
|
||||
endif
|
||||
|
||||
if COND_mips_qemu_mips
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h
|
||||
@ -135,6 +162,24 @@ 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/bitmap_scale.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/serial.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
||||
endif
|
||||
|
||||
if COND_mips_loongson
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/time.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.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/bitmap_scale.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cs5536.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pci.h
|
||||
@ -145,6 +190,11 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
||||
endif
|
||||
|
||||
if COND_mips_qemu_mips
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
|
||||
endif
|
||||
|
||||
if COND_powerpc_ieee1275
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||
@ -163,6 +213,7 @@ endif
|
||||
if COND_emu
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/datetime.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/misc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/export.h
|
||||
if COND_GRUB_EMU_SDL
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h
|
||||
endif
|
||||
@ -297,7 +348,7 @@ syminfo.lst: gensyminfo.sh kernel_syms.lst $(MODULE_FILES)
|
||||
mv $@.new $@
|
||||
|
||||
# generate global module dependencies list
|
||||
moddep.lst: syminfo.lst genmoddep.awk
|
||||
moddep.lst: syminfo.lst genmoddep.awk video.lst
|
||||
cat $< | sort | awk -f $(srcdir)/genmoddep.awk > $@ || (rm -f $@; exit 1)
|
||||
platform_DATA += moddep.lst
|
||||
CLEANFILES += config.log syminfo.lst moddep.lst
|
||||
@ -305,6 +356,7 @@ CLEANFILES += config.log syminfo.lst moddep.lst
|
||||
$(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT)
|
||||
TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@
|
||||
platform_DATA += $(MOD_FILES)
|
||||
platform_DATA += modinfo.sh
|
||||
CLEANFILES += $(MOD_FILES)
|
||||
|
||||
if COND_ENABLE_EFIEMU
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -53,8 +53,8 @@ grub_memmove (void *dest, const void *src, grub_size_t n)
|
||||
int
|
||||
grub_memcmp (const void *s1, const void *s2, grub_size_t n)
|
||||
{
|
||||
const char *t1 = s1;
|
||||
const char *t2 = s2;
|
||||
const unsigned char *t1 = s1;
|
||||
const unsigned char *t2 = s2;
|
||||
|
||||
while (n--)
|
||||
{
|
||||
|
@ -25,6 +25,9 @@ grub_decompress_core (void *src, void *dest, unsigned long n,
|
||||
char *d = (char *) dest;
|
||||
const char *s = (const char *) src;
|
||||
|
||||
if (d == s)
|
||||
return;
|
||||
|
||||
if (d < s)
|
||||
while (n--)
|
||||
*d++ = *s++;
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/boot.h>
|
||||
#include <grub/machine/boot.h>
|
||||
|
||||
/*
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/boot.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <multiboot.h>
|
||||
|
@ -56,7 +56,7 @@ _start:
|
||||
popw %si
|
||||
|
||||
/* this sets up for the first run through "bootloop" */
|
||||
movw $(firstlist - GRUB_BOOT_MACHINE_LIST_SIZE), %di
|
||||
movw $LOCAL(firstlist), %di
|
||||
|
||||
/* save the sector number of the second sector in %ebp */
|
||||
movl (%di), %ebp
|
||||
@ -363,7 +363,7 @@ LOCAL(message):
|
||||
.word 0
|
||||
|
||||
. = _start + 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:
|
||||
/* this is the sector start parameter, in logical sectors from
|
||||
@ -376,5 +376,3 @@ blocklist_default_len:
|
||||
blocklist_default_seg:
|
||||
/* this is the segment of the starting address to load the data into */
|
||||
.word (GRUB_BOOT_MACHINE_KERNEL_SEG + 0x20)
|
||||
|
||||
firstlist: /* this label has to be after the list data!!! */
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include <config.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/boot.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <multiboot.h>
|
||||
@ -178,20 +177,21 @@ real_code_2:
|
||||
pushw %es
|
||||
popw %ds
|
||||
|
||||
#if GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART + 4 < 0x200
|
||||
movl $0x200, %ecx
|
||||
addl %ecx, %esi
|
||||
#else
|
||||
movl $(GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART + 4), %ecx
|
||||
movl $0x1000, %ecx
|
||||
addl $0x200, %esi
|
||||
#endif
|
||||
movl $DATA_ADDR, %edi
|
||||
|
||||
call LOCAL(move_memory)
|
||||
|
||||
/* Check for multiboot signature. */
|
||||
cmpl $MULTIBOOT_HEADER_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART)
|
||||
movl $DATA_ADDR, %edi
|
||||
3:
|
||||
movl %ss:(%edi), %eax
|
||||
cmpl $MULTIBOOT_HEADER_MAGIC, %eax
|
||||
jz 1f
|
||||
addl $4, %edi
|
||||
cmpl $(DATA_ADDR + 0x1000), %edi
|
||||
jne 3b
|
||||
|
||||
movl (ramdisk_image - start), %esi
|
||||
movl (ramdisk_size - start), %ecx
|
||||
@ -200,21 +200,13 @@ real_code_2:
|
||||
|
||||
1:
|
||||
|
||||
movl %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_COMPRESSED_SIZE), %ecx
|
||||
#if GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART + 4 < 0x200
|
||||
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - 0x200), %ecx
|
||||
#else
|
||||
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - (GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART + 4)), %ecx
|
||||
#endif
|
||||
movl $(DATA_ADDR + 0x1000), %edi
|
||||
movl %ss:(DATA_ADDR + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE), %ecx
|
||||
addl $GRUB_DECOMPRESSOR_I386_PC_MAX_DECOMPRESSOR_SIZE, %ecx
|
||||
|
||||
2:
|
||||
call LOCAL(move_memory)
|
||||
|
||||
movsbl %dh, %eax
|
||||
movl %eax, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_INSTALL_DOS_PART)
|
||||
movsbl (reg_edx + 2 - start), %eax
|
||||
movl %eax, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_INSTALL_BSD_PART)
|
||||
|
||||
movb $0xFF, %dh
|
||||
|
||||
ljmp $(DATA_ADDR >> 4), $0
|
||||
|
377
grub-core/boot/i386/pc/startup_raw.S
Normal file
377
grub-core/boot/i386/pc/startup_raw.S
Normal file
@ -0,0 +1,377 @@
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2008,2009,2011 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/symbol.h>
|
||||
#include <grub/offsets.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
|
||||
#define ABS(x) ((x) - LOCAL (base) + GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200)
|
||||
|
||||
.file "startup_raw.S"
|
||||
|
||||
.text
|
||||
|
||||
/* Tell GAS to generate 16-bit instructions so that this code works
|
||||
in real mode. */
|
||||
.code16
|
||||
|
||||
.globl start, _start
|
||||
start:
|
||||
_start:
|
||||
LOCAL (base):
|
||||
/*
|
||||
* Guarantee that "main" is loaded at 0x0:0x8200.
|
||||
*/
|
||||
#ifdef __APPLE__
|
||||
ljmp $0, $(ABS(LOCAL (codestart)) - 0x10000)
|
||||
#else
|
||||
ljmp $0, $ABS(LOCAL (codestart))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is a special data area.
|
||||
*/
|
||||
|
||||
. = _start + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
|
||||
LOCAL(compressed_size):
|
||||
.long 0
|
||||
. = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
|
||||
LOCAL(uncompressed_size):
|
||||
.long 0
|
||||
|
||||
. = _start + GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY
|
||||
reed_solomon_redundancy:
|
||||
.long 0
|
||||
. = _start + 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
|
||||
LOCAL(boot_dev):
|
||||
.byte 0xFF, 0xFF, 0xFF
|
||||
LOCAL(boot_drive):
|
||||
.byte 0x00
|
||||
|
||||
/* the real mode code continues... */
|
||||
LOCAL (codestart):
|
||||
cli /* we're not safe here! */
|
||||
|
||||
/* set up %ds, %ss, and %es */
|
||||
xorw %ax, %ax
|
||||
movw %ax, %ds
|
||||
movw %ax, %ss
|
||||
movw %ax, %es
|
||||
|
||||
/* set up the real mode/BIOS stack */
|
||||
movl $GRUB_MEMORY_MACHINE_REAL_STACK, %ebp
|
||||
movl %ebp, %esp
|
||||
|
||||
sti /* we're safe again */
|
||||
|
||||
/* save the boot drive */
|
||||
ADDR32 movb %dl, LOCAL(boot_drive)
|
||||
|
||||
/* reset disk system (%ah = 0) */
|
||||
int $0x13
|
||||
|
||||
/* transition to protected mode */
|
||||
DATA32 call real_to_prot
|
||||
|
||||
/* The ".code32" directive takes GAS out of 16-bit mode. */
|
||||
.code32
|
||||
|
||||
incl %eax
|
||||
cld
|
||||
call grub_gate_a20
|
||||
|
||||
movl LOCAL(compressed_size), %edx
|
||||
#ifdef __APPLE__
|
||||
addl $decompressor_end, %edx
|
||||
subl $(LOCAL(reed_solomon_part)), %edx
|
||||
#else
|
||||
addl $(LOCAL(decompressor_end) - LOCAL(reed_solomon_part)), %edx
|
||||
#endif
|
||||
movl reed_solomon_redundancy, %ecx
|
||||
leal LOCAL(reed_solomon_part), %eax
|
||||
cld
|
||||
call EXT_C (grub_reed_solomon_recover)
|
||||
jmp post_reed_solomon
|
||||
|
||||
#include "../../../kern/i386/realmode.S"
|
||||
|
||||
#include <rs_decoder.S>
|
||||
|
||||
.text
|
||||
|
||||
/*
|
||||
* grub_gate_a20(int on)
|
||||
*
|
||||
* Gate address-line 20 for high memory.
|
||||
*
|
||||
* This routine is probably overconservative in what it does, but so what?
|
||||
*
|
||||
* It also eats any keystrokes in the keyboard buffer. :-(
|
||||
*/
|
||||
|
||||
grub_gate_a20:
|
||||
movl %eax, %edx
|
||||
|
||||
gate_a20_test_current_state:
|
||||
/* first of all, test if already in a good state */
|
||||
call gate_a20_check_state
|
||||
cmpb %al, %dl
|
||||
jnz gate_a20_try_bios
|
||||
ret
|
||||
|
||||
gate_a20_try_bios:
|
||||
/* second, try a BIOS call */
|
||||
pushl %ebp
|
||||
call prot_to_real
|
||||
|
||||
.code16
|
||||
movw $0x2400, %ax
|
||||
testb %dl, %dl
|
||||
jz 1f
|
||||
incw %ax
|
||||
1: int $0x15
|
||||
|
||||
DATA32 call real_to_prot
|
||||
.code32
|
||||
|
||||
popl %ebp
|
||||
call gate_a20_check_state
|
||||
cmpb %al, %dl
|
||||
jnz gate_a20_try_system_control_port_a
|
||||
ret
|
||||
|
||||
gate_a20_try_system_control_port_a:
|
||||
/*
|
||||
* In macbook, the keyboard test would hang the machine, so we move
|
||||
* this forward.
|
||||
*/
|
||||
/* fourth, try the system control port A */
|
||||
inb $0x92
|
||||
andb $(~0x03), %al
|
||||
testb %dl, %dl
|
||||
jz 6f
|
||||
orb $0x02, %al
|
||||
6: outb $0x92
|
||||
|
||||
/* When turning off Gate A20, do not check the state strictly,
|
||||
because a failure is not fatal usually, and Gate A20 is always
|
||||
on some modern machines. */
|
||||
testb %dl, %dl
|
||||
jz 7f
|
||||
call gate_a20_check_state
|
||||
cmpb %al, %dl
|
||||
jnz gate_a20_try_keyboard_controller
|
||||
7: ret
|
||||
|
||||
gate_a20_flush_keyboard_buffer:
|
||||
inb $0x64
|
||||
andb $0x02, %al
|
||||
jnz gate_a20_flush_keyboard_buffer
|
||||
2:
|
||||
inb $0x64
|
||||
andb $0x01, %al
|
||||
jz 3f
|
||||
inb $0x60
|
||||
jmp 2b
|
||||
3:
|
||||
ret
|
||||
|
||||
gate_a20_try_keyboard_controller:
|
||||
/* third, try the keyboard controller */
|
||||
call gate_a20_flush_keyboard_buffer
|
||||
|
||||
movb $0xd1, %al
|
||||
outb $0x64
|
||||
4:
|
||||
inb $0x64
|
||||
andb $0x02, %al
|
||||
jnz 4b
|
||||
|
||||
movb $0xdd, %al
|
||||
testb %dl, %dl
|
||||
jz 5f
|
||||
orb $0x02, %al
|
||||
5: outb $0x60
|
||||
call gate_a20_flush_keyboard_buffer
|
||||
|
||||
/* output a dummy command (USB keyboard hack) */
|
||||
movb $0xff, %al
|
||||
outb $0x64
|
||||
call gate_a20_flush_keyboard_buffer
|
||||
|
||||
call gate_a20_check_state
|
||||
cmpb %al, %dl
|
||||
/* everything failed, so restart from the beginning */
|
||||
jnz gate_a20_try_bios
|
||||
ret
|
||||
|
||||
gate_a20_check_state:
|
||||
/* iterate the checking for a while */
|
||||
movl $100, %ecx
|
||||
1:
|
||||
call 3f
|
||||
cmpb %al, %dl
|
||||
jz 2f
|
||||
loop 1b
|
||||
2:
|
||||
ret
|
||||
3:
|
||||
pushl %ebx
|
||||
pushl %ecx
|
||||
xorl %eax, %eax
|
||||
/* compare the byte at 0x8000 with that at 0x108000 */
|
||||
movl $GRUB_BOOT_MACHINE_KERNEL_ADDR, %ebx
|
||||
pushl %ebx
|
||||
/* save the original byte in CL */
|
||||
movb (%ebx), %cl
|
||||
/* store the value at 0x108000 in AL */
|
||||
addl $0x100000, %ebx
|
||||
movb (%ebx), %al
|
||||
/* try to set one less value at 0x8000 */
|
||||
popl %ebx
|
||||
movb %al, %ch
|
||||
decb %ch
|
||||
movb %ch, (%ebx)
|
||||
/* serialize */
|
||||
outb %al, $0x80
|
||||
outb %al, $0x80
|
||||
/* obtain the value at 0x108000 in CH */
|
||||
pushl %ebx
|
||||
addl $0x100000, %ebx
|
||||
movb (%ebx), %ch
|
||||
/* this result is 1 if A20 is on or 0 if it is off */
|
||||
subb %ch, %al
|
||||
xorb $1, %al
|
||||
/* restore the original */
|
||||
popl %ebx
|
||||
movb %cl, (%ebx)
|
||||
popl %ecx
|
||||
popl %ebx
|
||||
ret
|
||||
|
||||
LOCAL(reed_solomon_part):
|
||||
|
||||
/*
|
||||
* Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself).
|
||||
* This uses the a.out kludge to load raw binary to the area starting at 1MB,
|
||||
* and relocates itself after loaded.
|
||||
*/
|
||||
.p2align 2 /* force 4-byte alignment */
|
||||
multiboot_header:
|
||||
/* magic */
|
||||
.long 0x1BADB002
|
||||
/* flags */
|
||||
.long (1 << 16)
|
||||
/* checksum */
|
||||
.long -0x1BADB002 - (1 << 16)
|
||||
/* header addr */
|
||||
.long multiboot_header - _start + 0x100000 + 0x200
|
||||
/* load addr */
|
||||
.long 0x100000
|
||||
/* load end addr */
|
||||
.long 0
|
||||
/* bss end addr */
|
||||
.long 0
|
||||
/* entry addr */
|
||||
.long multiboot_entry - _start + 0x100000 + 0x200
|
||||
|
||||
multiboot_entry:
|
||||
.code32
|
||||
/* obtain the boot device */
|
||||
movl 12(%ebx), %edx
|
||||
|
||||
movl $GRUB_MEMORY_MACHINE_PROT_STACK, %ebp
|
||||
movl %ebp, %esp
|
||||
|
||||
/* relocate the code */
|
||||
#ifdef __APPLE__
|
||||
LOCAL(compressed_size_offset) = LOCAL(compressed_size) - LOCAL(base)
|
||||
movl $0x200, %ecx
|
||||
addl $decompressor_end, %ecx
|
||||
subl $LOCAL(base), %ecx
|
||||
addl LOCAL(compressed_size_offset) + 0x100000 + 0x200, %ecx
|
||||
#else
|
||||
movl $(LOCAL(decompressor_end) - _start + 0x200), %ecx
|
||||
addl LOCAL(compressed_size) - _start + 0x100000 + 0x200, %ecx
|
||||
#endif
|
||||
movl $0x100000, %esi
|
||||
movl $GRUB_BOOT_MACHINE_KERNEL_ADDR, %edi
|
||||
cld
|
||||
rep
|
||||
movsb
|
||||
/* jump to the real address */
|
||||
movl $multiboot_trampoline, %eax
|
||||
jmp *%eax
|
||||
|
||||
multiboot_trampoline:
|
||||
/* fill the boot information */
|
||||
movl %edx, LOCAL(boot_dev)
|
||||
shrl $24, %edx
|
||||
/* enter the usual booting */
|
||||
call prot_to_real
|
||||
.code16
|
||||
jmp LOCAL (codestart)
|
||||
.code32
|
||||
|
||||
post_reed_solomon:
|
||||
|
||||
#ifdef ENABLE_LZMA
|
||||
movl $GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR, %edi
|
||||
#ifdef __APPLE__
|
||||
movl $decompressor_end, %esi
|
||||
#else
|
||||
movl $LOCAL(decompressor_end), %esi
|
||||
#endif
|
||||
pushl %edi
|
||||
movl LOCAL (uncompressed_size), %ecx
|
||||
leal (%edi, %ecx), %ebx
|
||||
/* Don't remove this push: it's an argument. */
|
||||
push %ecx
|
||||
call _LzmaDecodeA
|
||||
pop %ecx
|
||||
/* _LzmaDecodeA clears DF, so no need to run cld */
|
||||
popl %esi
|
||||
#endif
|
||||
|
||||
movl LOCAL(boot_dev), %edx
|
||||
movl $prot_to_real, %edi
|
||||
movl $real_to_prot, %ecx
|
||||
movl $LOCAL(realidt), %eax
|
||||
jmp *%esi
|
||||
|
||||
#ifdef ENABLE_LZMA
|
||||
#include "lzma_decode.S"
|
||||
#endif
|
||||
|
||||
.p2align 4
|
||||
|
||||
#ifdef __APPLE__
|
||||
.zerofill __DATA, __aa_before_bss, decompressor_end, 10, 0
|
||||
#else
|
||||
.bss
|
||||
LOCAL(decompressor_end):
|
||||
#endif
|
2
grub-core/boot/mips/loongson/fuloong2f.S
Normal file
2
grub-core/boot/mips/loongson/fuloong2f.S
Normal file
@ -0,0 +1,2 @@
|
||||
#define FULOONG2F 1
|
||||
#include "fwstart.S"
|
@ -16,15 +16,30 @@
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/mips/yeeloong/serial.h>
|
||||
#include <grub/mips/yeeloong/pci.h>
|
||||
#include <grub/mips/loongson/serial.h>
|
||||
#include <grub/mips/loongson/pci.h>
|
||||
#include <grub/mips/loongson.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/machine/serial.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <grub/ns8250.h>
|
||||
#include <grub/cs5536.h>
|
||||
#include <grub/smbus.h>
|
||||
|
||||
#ifndef FULOONG2F
|
||||
#include <grub/vgaregs.h>
|
||||
#define GRUB_SM712_REG_BASE 0x700000
|
||||
#define GRUB_SM712_PCIID 0x0712126f
|
||||
#endif
|
||||
|
||||
#ifdef FULOONG2F
|
||||
#define GRUB_MACHINE_SERIAL_PORT GRUB_MACHINE_SERIAL_PORT2
|
||||
#define GRUB_MACHINE_SERIAL_DIVISOR_115200 GRUB_MACHINE_SERIAL_PORT2_DIVISOR_115200
|
||||
#else
|
||||
#define GRUB_MACHINE_SERIAL_PORT GRUB_MACHINE_SERIAL_PORT0
|
||||
#define GRUB_MACHINE_SERIAL_DIVISOR_115200 GRUB_MACHINE_SERIAL_PORT0_DIVISOR_115200
|
||||
#endif
|
||||
|
||||
.set noreorder
|
||||
.set noat
|
||||
.set nomacro
|
||||
@ -34,34 +49,47 @@
|
||||
start:
|
||||
_start:
|
||||
__start:
|
||||
/* Put serial init as soon as possible. But on Fuloong2f serial is past
|
||||
Geode, so on Fuloong2f we need Geode first.
|
||||
*/
|
||||
#ifndef FULOONG2F
|
||||
bal serial_hw_init
|
||||
nop
|
||||
#endif
|
||||
|
||||
/* Find CS5536 controller. */
|
||||
/* $t4 chooses device in priority encoding. */
|
||||
/* Resulting value is kept in GRUB_MACHINE_PCI_CONF_CTRL_REG.
|
||||
This way we don't need to sacrifice a register for it. */
|
||||
retry_cs5536:
|
||||
/* We have only one bus (0). Function is 0. */
|
||||
lui $t0, %hi(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR)
|
||||
lui $t1, %hi(GRUB_MACHINE_PCI_CONFSPACE)
|
||||
lui $t3, %hi(GRUB_CS5536_PCIID)
|
||||
addiu $t3, $t3, %lo(GRUB_CS5536_PCIID)
|
||||
ori $t4, $zero, 1
|
||||
lui $a0, %hi(no_cs5536)
|
||||
1:
|
||||
andi $t4, $t4, ((1 << GRUB_PCI_NUM_DEVICES) - 1)
|
||||
beql $t4, $zero, fatal
|
||||
addiu $a0, $a0, %lo(no_cs5536)
|
||||
/* In case of failure try again. CS5536 may be slow to come up. */
|
||||
beql $t4, $zero, retry_cs5536
|
||||
nop
|
||||
sw $t4, %lo(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR) ($t0)
|
||||
lw $t2, (%lo(GRUB_MACHINE_PCI_CONFSPACE) + GRUB_PCI_REG_PCI_ID) ($t1)
|
||||
bnel $t2, $t3, 1b
|
||||
sll $t4, $t4, 1
|
||||
|
||||
#ifndef FULOONG2F
|
||||
lui $a0, %hi(cs5536_found)
|
||||
bal message
|
||||
addiu $a0, $a0, %lo(cs5536_found)
|
||||
bal printhex
|
||||
move $a0, $t4
|
||||
#endif
|
||||
|
||||
/* Initialise SMBus controller. */
|
||||
lui $t0, %hi(GRUB_MACHINE_PCI_CONFSPACE)
|
||||
li $t1, GRUB_CS5536_MSR_MAILBOX_CONFIG_ENABLED
|
||||
sw $t1, (%lo(GRUB_MACHINE_PCI_CONFSPACE) + GRUB_CS5536_MSR_MAILBOX_CONFIG) ($t0)
|
||||
|
||||
/* Set GPIO LBAR. */
|
||||
lui $a0, %hi(GRUB_CS5536_MSR_GPIO_BAR)
|
||||
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_GPIO_BAR)
|
||||
@ -71,6 +99,15 @@ __start:
|
||||
ori $a2, $zero, ((GRUB_CS5536_LBAR_MASK_MASK \
|
||||
| GRUB_CS5536_LBAR_ENABLE) >> 32)
|
||||
|
||||
bal gpio_init
|
||||
nop
|
||||
|
||||
#ifdef FULOONG2F
|
||||
bal serial_hw_init
|
||||
nop
|
||||
#endif
|
||||
|
||||
/* Initialise SMBus controller. */
|
||||
/* Set SMBUS LBAR. */
|
||||
lui $a0, %hi(GRUB_CS5536_MSR_SMB_BAR)
|
||||
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_SMB_BAR)
|
||||
@ -84,14 +121,6 @@ __start:
|
||||
bal message
|
||||
addiu $a0, $a0, %lo(smbus_enabled)
|
||||
|
||||
/* Enable SMBus controller pins. */
|
||||
lui $t0, %hi(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_GPIO)
|
||||
ori $t1, $zero, GRUB_GPIO_SMBUS_PINS
|
||||
sw $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_GPIO + GRUB_GPIO_REG_OUT_EN) ($t0)
|
||||
sw $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_GPIO + GRUB_GPIO_REG_OUT_AUX1) ($t0)
|
||||
sw $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_GPIO + GRUB_GPIO_REG_IN_EN) ($t0)
|
||||
sw $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_GPIO + GRUB_GPIO_REG_IN_AUX1) ($t0)
|
||||
|
||||
lui $t0, %hi(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_SMBUS)
|
||||
|
||||
/* Disable SMB. */
|
||||
@ -108,7 +137,7 @@ __start:
|
||||
sb $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL3) ($t0)
|
||||
sb $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL2) ($t0)
|
||||
|
||||
/* Yeeloong has only one memory slot. */
|
||||
/* Yeeloong and Fuloong2f have only one memory slot. */
|
||||
/* Output first byte on serial for debugging. */
|
||||
ori $a1, $zero, GRUB_SMB_RAM_START_ADDR
|
||||
bal read_spd
|
||||
@ -207,10 +236,54 @@ other_exception:
|
||||
b fatal
|
||||
addiu $a0, $a0, %lo(unhandled_exception)
|
||||
|
||||
gpio_init:
|
||||
lui $t0, %hi(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_GPIO)
|
||||
addiu $t0, $t0, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_GPIO)
|
||||
lui $t1, %hi (gpio_dump)
|
||||
addiu $t1, $t1, %lo (gpio_dump)
|
||||
|
||||
1:
|
||||
lw $t2, 0($t1)
|
||||
sw $t2, 0($t0)
|
||||
addiu $t0, $t0, 4
|
||||
addiu $t1, $t1, 4
|
||||
lui $t2, %hi (gpio_dump_end)
|
||||
addiu $t2, $t2, %lo (gpio_dump_end)
|
||||
bne $t1, $t2, 1b
|
||||
nop
|
||||
jr $ra
|
||||
nop
|
||||
|
||||
/* Same as similarly named C function but in asm since
|
||||
we need it early. */
|
||||
/* In: none. Out: none. Clobbered: $t0, $t1, $a0. */
|
||||
/* In: none. Out: none. Clobbered: $t0, $t1, $t2, $a0, $a1, $a2. */
|
||||
serial_hw_init:
|
||||
move $t2, $ra
|
||||
#ifdef FULOONG2F
|
||||
lui $a0, %hi(GRUB_CS5536_MSR_DIVIL_LEG_IO)
|
||||
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_DIVIL_LEG_IO)
|
||||
lui $a1, %hi (GRUB_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3 \
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP \
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_MODE_X86 \
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_UART1_COM1)
|
||||
ori $a1, $a1, (GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0 \
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1)
|
||||
bal wrmsr
|
||||
move $a2, $zero
|
||||
|
||||
lui $a0, %hi(GRUB_CS5536_MSR_DIVIL_UART1_CONF)
|
||||
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_DIVIL_UART1_CONF)
|
||||
li $a1, 2
|
||||
bal wrmsr
|
||||
move $a2, $zero
|
||||
|
||||
lui $a0, %hi(GRUB_CS5536_MSR_DIVIL_UART2_CONF)
|
||||
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_DIVIL_UART2_CONF)
|
||||
li $a1, 2
|
||||
bal wrmsr
|
||||
move $a2, $zero
|
||||
#endif
|
||||
|
||||
lui $t0, %hi (GRUB_MACHINE_SERIAL_PORT)
|
||||
|
||||
/* Turn off the interrupt. */
|
||||
@ -240,6 +313,7 @@ serial_hw_init:
|
||||
/* Let message return to original caller. */
|
||||
lui $a0, %hi(notification_string)
|
||||
addiu $a0, $a0, %lo(notification_string)
|
||||
move $ra, $t2
|
||||
|
||||
/* Print message on serial console. */
|
||||
/* In: $a0 = asciiz message. Out: none. Clobbered: $t0, $t1, $a0. */
|
||||
@ -380,7 +454,6 @@ read_spd_fail:
|
||||
ori $v0, $v0, 0x100
|
||||
|
||||
notification_string: .asciz "GRUB "
|
||||
no_cs5536: .asciz "No CS5536 found.\n\r"
|
||||
cs5536_found: .asciz "CS5536 at "
|
||||
sm_failed: .asciz "SM transaction failed.\n\r"
|
||||
unhandled_tlb_refill: .asciz "Unhandled TLB refill.\n\r"
|
||||
@ -405,14 +478,22 @@ regdump:
|
||||
.quad 0x0100020200010101 /* 4 */
|
||||
.quad 0x0a04030603050203 /* 6 */
|
||||
.quad 0x0f0e040000010a0b /* 7 */
|
||||
#ifdef FULOONG2F
|
||||
.quad 0x0000000100000001 /* 8 */
|
||||
#else
|
||||
.quad 0x0000010200000102 /* 8 */
|
||||
#endif
|
||||
.quad 0x0000060c00000000 /* 9 */
|
||||
.quad 0x2323233f3f1f0200 /* a */
|
||||
.quad 0x5f7f232323232323 /* b */
|
||||
.quad 0x002a3c0615000000 /* c */
|
||||
.quad 0x002a002a002a002a /* d */
|
||||
.quad 0x002a002a002a002a /* e */
|
||||
#ifdef FULOONG2F
|
||||
.quad 0x00b40020005b0004 /* f */
|
||||
#else
|
||||
.quad 0x00b40020006d0004 /* f */
|
||||
#endif
|
||||
.quad 0x070007ff00000087 /* 10 */
|
||||
.quad 0x000000000016101f /* 11 */
|
||||
.quad 0x001c000000000000 /* 12 */
|
||||
@ -427,6 +508,45 @@ regdump:
|
||||
.quad 0 /* 1b */
|
||||
.quad 0 /* 1c */
|
||||
|
||||
/* Dump of GPIO connections. FIXME: Remove useless and macroify. */
|
||||
gpio_dump:
|
||||
#ifdef FULOONG2F
|
||||
.long 0xffff0000, 0x2eefd110, 0xffff0000, 0xffff0000
|
||||
.long 0x2eefd110, 0xffff0000, 0x1000efff, 0xefff1000
|
||||
.long 0x3df3c20c, 0xffff0000, 0xffff0000, 0xffff0000
|
||||
.long 0x7df3820c, 0x3df3c20c, 0xffff0000, 0x00000000
|
||||
.long 0xffff0000, 0xffff0000, 0x3de3c21c, 0x3d83c27c
|
||||
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
.long 0xffff0000, 0xffff0000, 0xffff0000, 0xffff0000
|
||||
.long 0xffff0000, 0xffff0000, 0x0000ffff, 0xffff0000
|
||||
.long 0xefff1000, 0xffff0000, 0xffff0000, 0xffff0000
|
||||
.long 0xefff1000, 0xefff1000, 0xffff0000, 0x00000000
|
||||
.long 0xffff0000, 0xffff0000, 0xefff1000, 0xefff1000
|
||||
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
#else
|
||||
.long 0xffff0000, 0x2ffdd002, 0xffff0000, 0xffff0000
|
||||
.long 0x2fffd000, 0xffff0000, 0x1000efff, 0xefff1000
|
||||
.long 0x3ffbc004, 0xffff0000, 0xffff0000, 0xffff0000
|
||||
.long 0x3ffbc004, 0x3ffbc004, 0xffff0000, 0x00000000
|
||||
.long 0xffff0000, 0xffff0000, 0x3ffbc004, 0x3f9bc064
|
||||
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
.long 0xffff0000, 0xffff0000, 0xffff0000, 0xffff0000
|
||||
.long 0xffff0000, 0xffff0000, 0x0000ffff, 0xffff0000
|
||||
.long 0xefff1000, 0xffff0000, 0xffff0000, 0xffff0000
|
||||
.long 0xefff1000, 0xefff1000, 0xffff0000, 0x00000000
|
||||
.long 0xffff0000, 0xffff0000, 0xefff1000, 0xffff0000
|
||||
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||
.long 0x00000000, 0x50000000, 0x00000000, 0x00000000
|
||||
#endif
|
||||
gpio_dump_end:
|
||||
|
||||
.p2align
|
||||
|
||||
write_dumpreg:
|
||||
@ -627,6 +747,147 @@ continue:
|
||||
lui $t0, %hi(cached_continue - 0x20000000)
|
||||
addiu $t0, $t0, %lo(cached_continue - 0x20000000)
|
||||
jr $t0
|
||||
addiu $a2, $zero, -1
|
||||
#ifdef FULOONG2F
|
||||
addiu $a2, $zero, -(1 + GRUB_ARCH_MACHINE_FULOONG2F)
|
||||
#else
|
||||
addiu $a2, $zero, -(1 + GRUB_ARCH_MACHINE_YEELOONG)
|
||||
#endif
|
||||
|
||||
cached_continue:
|
||||
cached_continue:
|
||||
#ifndef FULOONG2F
|
||||
/* We have to init video early enough or watchdog will reboot us. */
|
||||
|
||||
/* Setup PCI controller. */
|
||||
|
||||
lui $t0, %hi (GRUB_CPU_LOONGSON_PCI_HIT1_SEL_LO)
|
||||
lui $t1, %hi(0x8000000c)
|
||||
addiu $t1, $t1, %lo(0x8000000c)
|
||||
|
||||
sw $t1, %lo (GRUB_CPU_LOONGSON_PCI_HIT1_SEL_LO) ($t0)
|
||||
li $t1, 0xffffffff
|
||||
sw $t1, %lo (GRUB_CPU_LOONGSON_PCI_HIT1_SEL_HI) ($t0)
|
||||
|
||||
li $t0, GRUB_MACHINE_PCI_CONTROLLER_HEADER
|
||||
li $t1, (GRUB_PCI_COMMAND_PARITY_ERROR | GRUB_PCI_COMMAND_BUS_MASTER \
|
||||
| GRUB_PCI_COMMAND_MEM_ENABLED)
|
||||
sh $t0, GRUB_PCI_REG_COMMAND ($t1)
|
||||
li $t1, ((1 << GRUB_PCI_STATUS_DEVSEL_TIMING_SHIFT) \
|
||||
| GRUB_PCI_STATUS_FAST_B2B_CAPABLE \
|
||||
| GRUB_PCI_STATUS_66MHZ_CAPABLE \
|
||||
| GRUB_PCI_STATUS_CAPABILITIES)
|
||||
sh $t0, GRUB_PCI_REG_STATUS ($t1)
|
||||
li $t0, 0xff
|
||||
sw $t0, GRUB_PCI_REG_CACHELINE ($t1)
|
||||
lui $t1, %hi(0x80000000 | GRUB_PCI_ADDR_MEM_TYPE_64 \
|
||||
| GRUB_PCI_ADDR_MEM_PREFETCH)
|
||||
addiu $t1, $t1, %lo(0x80000000 | GRUB_PCI_ADDR_MEM_TYPE_64 \
|
||||
| GRUB_PCI_ADDR_MEM_PREFETCH)
|
||||
sw $t0, GRUB_PCI_REG_ADDRESS_REG0 ($t1)
|
||||
sw $zero, GRUB_PCI_REG_ADDRESS_REG1 ($t1)
|
||||
|
||||
/* Find video. */
|
||||
/* $t4 chooses device in priority encoding. */
|
||||
/* Resulting value is kept in GRUB_MACHINE_PCI_CONF_CTRL_REG.
|
||||
This way we don't need to sacrifice a register for it. */
|
||||
retry_sm712:
|
||||
/* We have only one bus (0). Function is 0. */
|
||||
lui $t0, %hi(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR)
|
||||
lui $t1, %hi(GRUB_MACHINE_PCI_CONFSPACE)
|
||||
lui $t3, %hi(GRUB_SM712_PCIID)
|
||||
addiu $t3, $t3, %lo(GRUB_SM712_PCIID)
|
||||
ori $t4, $zero, 1
|
||||
1:
|
||||
andi $t4, $t4, ((1 << GRUB_PCI_NUM_DEVICES) - 1)
|
||||
/* In case of failure try again. SM712 may be slow to come up. */
|
||||
beql $t4, $zero, retry_sm712
|
||||
nop
|
||||
sw $t4, %lo(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR) ($t0)
|
||||
lw $t2, (%lo(GRUB_MACHINE_PCI_CONFSPACE) + GRUB_PCI_REG_PCI_ID) ($t1)
|
||||
bnel $t2, $t3, 1b
|
||||
sll $t4, $t4, 1
|
||||
|
||||
/* FIXME: choose address dynamically if needed. */
|
||||
#define SM712_MAP 0x04000000
|
||||
|
||||
lui $t2, %hi(SM712_MAP)
|
||||
sw $t4, %lo(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR) ($t0)
|
||||
sw $t2, (%lo(GRUB_MACHINE_PCI_CONFSPACE) + GRUB_PCI_REG_ADDRESS_REG0) ($t1)
|
||||
|
||||
/* Set latency. */
|
||||
li $t2, 0x8
|
||||
sw $t4, %lo(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR) ($t0)
|
||||
sw $t2, (%lo(GRUB_MACHINE_PCI_CONFSPACE) + GRUB_PCI_REG_CACHELINE) ($t1)
|
||||
|
||||
/* Enable address spaces. */
|
||||
li $t2, 0x7
|
||||
sw $t4, %lo(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR) ($t0)
|
||||
sw $t2, (%lo(GRUB_MACHINE_PCI_CONFSPACE) + GRUB_PCI_REG_COMMAND) ($t1)
|
||||
|
||||
lui $t3, %hi(GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_INDEX)
|
||||
li $t2, 0x18
|
||||
sb $t2, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_INDEX)($t3)
|
||||
|
||||
lui $t3, %hi(GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_DATA)
|
||||
li $t2, 0x11
|
||||
sb $t2, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_VGA_IO_SR_DATA)($t3)
|
||||
|
||||
li $t2, ((((SM712_MAP & ~GRUB_MACHINE_PCI_WIN_OFFSET_MASK) \
|
||||
>> GRUB_MACHINE_PCI_WIN_SHIFT) \
|
||||
& GRUB_MACHINE_PCI_WIN_MASK))
|
||||
lui $t3, %hi(0xbfe00110)
|
||||
addiu $t3, $t3, %lo(0xbfe00110)
|
||||
sw $t2, 0 ($t3)
|
||||
li $t2, (GRUB_MACHINE_PCI_WIN1_ADDR \
|
||||
| (SM712_MAP & GRUB_MACHINE_PCI_WIN_OFFSET_MASK))
|
||||
|
||||
lui $t3, %hi(GRUB_SM712_REG_BASE)
|
||||
addiu $t3, $t3, %lo(GRUB_SM712_REG_BASE)
|
||||
addu $t2, $t2, $t3
|
||||
lui $t0, %hi(init_table - 0x20000000)
|
||||
addiu $t0, $t0, %lo(init_table - 0x20000000)
|
||||
lui $t1, %hi(init_table_end - 0x20000000)
|
||||
addiu $t1, $t1, %lo(init_table_end - 0x20000000)
|
||||
li $t5, 0x80
|
||||
addiu $t6, $t2, 0x3c0
|
||||
|
||||
table_cont:
|
||||
lb $t3, 0($t0)
|
||||
andi $t5, $t3, 0x80
|
||||
andi $t3, $t3, 0x7f
|
||||
addu $t3, $t3, $t6
|
||||
lb $t4, 1($t0)
|
||||
|
||||
bne $zero, $t5, 1f
|
||||
addiu $t0, $t0, 2
|
||||
b 2f
|
||||
sb $t4, 0($t3)
|
||||
1:
|
||||
lb $t4, 0($t3)
|
||||
2:
|
||||
bne $t0, $t1, table_cont
|
||||
nop
|
||||
|
||||
lui $t3, %hi(0x40c000 - GRUB_SM712_REG_BASE)
|
||||
addiu $t3, $t3, %lo(0x40c000 - GRUB_SM712_REG_BASE)
|
||||
addu $t1, $t2, $t3
|
||||
sw $zero, 0xc ($t1)
|
||||
sw $zero, 0x40 ($t1)
|
||||
li $t3, 0x20000
|
||||
sw $t3, 0x0 ($t1)
|
||||
lui $t3, %hi(0x1020100)
|
||||
addiu $t3, $t3, %lo(0x1020100)
|
||||
sw $t3, 0x10 ($t1)
|
||||
|
||||
li $t4, 0x16
|
||||
sb $t4, GRUB_VGA_IO_SR_INDEX($t2)
|
||||
|
||||
lb $t4, GRUB_VGA_IO_SR_DATA($t2)
|
||||
|
||||
b init_end
|
||||
nop
|
||||
init_table:
|
||||
#include "sm712_start.S"
|
||||
init_table_end:
|
||||
.align 4
|
||||
init_end:
|
||||
#endif
|
@ -20,6 +20,7 @@
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/offsets.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <grub/offsets.h>
|
||||
|
||||
#define BASE_ADDR 8
|
||||
@ -37,27 +38,51 @@ start:
|
||||
bal codestart
|
||||
nop
|
||||
base:
|
||||
. = _start + GRUB_KERNEL_MACHINE_COMPRESSED_SIZE
|
||||
. = _start + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
|
||||
compressed_size:
|
||||
.long 0
|
||||
. = _start + GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE
|
||||
. = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
|
||||
uncompressed_size:
|
||||
.long 0
|
||||
. = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR
|
||||
uncompressed_addr:
|
||||
.long 0
|
||||
codestart:
|
||||
/* Save our base. */
|
||||
move $s0, $ra
|
||||
|
||||
/* Parse arguments. Has to be done before relocation.
|
||||
So need to do it in asm. */
|
||||
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
||||
#ifdef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
lui $t0, %hi (((16 << 20) - 264 + 4) | 0x80000000)
|
||||
lw $t1, %lo (((16 << 20) - 264 + 4) | 0x80000000) ($t0)
|
||||
|
||||
lui $t2, 0x1234
|
||||
ori $t2, 0x5678
|
||||
|
||||
bne $t1, $t2, 1f
|
||||
nop
|
||||
|
||||
lui $t0, %hi (((16 << 20) - 264) | 0x80000000)
|
||||
b 2f
|
||||
lw $s4, %lo (((16 << 20) - 264) | 0x80000000) ($t0)
|
||||
|
||||
1:
|
||||
li $s4, 0
|
||||
2:
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
move $s2, $zero
|
||||
move $s3, $zero
|
||||
move $s4, $zero
|
||||
move $s5, $zero
|
||||
move $s7, $zero
|
||||
|
||||
/* $a2 has the environment. */
|
||||
addiu $t0, $a2, 1
|
||||
beq $t0, $zero, argdone
|
||||
addiu $t0, $zero, -0x10
|
||||
and $t1, $a2, $t0
|
||||
beq $t0, $t1, argfw
|
||||
nop
|
||||
move $t0, $a2
|
||||
argcont:
|
||||
@ -72,11 +97,19 @@ argcont:
|
||||
nop ;\
|
||||
b 2f;\
|
||||
move reg, $v0; \
|
||||
1:
|
||||
1:
|
||||
#define DO_CHECKT1(str, val) \
|
||||
move $t6, $t1 ;\
|
||||
addiu $t7, $s0, (str - base);\
|
||||
bal do_check ;\
|
||||
li $t2, val
|
||||
|
||||
DO_PARSE (busclockstr, $s2)
|
||||
DO_PARSE (cpuclockstr, $s3)
|
||||
DO_PARSE (memsizestr, $s4)
|
||||
DO_PARSE (highmemsizestr, $s5)
|
||||
DO_CHECKT1 (pmon_yeeloong_verstr, GRUB_ARCH_MACHINE_YEELOONG)
|
||||
DO_CHECKT1 (pmon_fuloong2f_verstr, GRUB_ARCH_MACHINE_FULOONG2F)
|
||||
2:
|
||||
b argcont
|
||||
addiu $t0, $t0, 4
|
||||
@ -120,8 +153,49 @@ 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"
|
||||
.p2align 2
|
||||
|
||||
argdone:
|
||||
beq $a0, $zero, cmdlinedone
|
||||
nop
|
||||
#define DO_CHECKA1(str, val) \
|
||||
lw $t6, 0($a1) ;\
|
||||
addiu $t7, $s0, (str - base);\
|
||||
bal do_check ;\
|
||||
li $t2, val
|
||||
DO_CHECKA1 (machtype_yeeloong_str1, GRUB_ARCH_MACHINE_YEELOONG)
|
||||
DO_CHECKA1 (machtype_yeeloong_str2, GRUB_ARCH_MACHINE_YEELOONG)
|
||||
DO_CHECKA1 (pmon_yeeloong_str, GRUB_ARCH_MACHINE_YEELOONG)
|
||||
DO_CHECKA1 (machtype_fuloong2f_str, GRUB_ARCH_MACHINE_FULOONG2F)
|
||||
DO_CHECKA1 (machtype_fuloong2e_str, GRUB_ARCH_MACHINE_FULOONG2E)
|
||||
DO_CHECKA1 (pmon_fuloong2f_str, GRUB_ARCH_MACHINE_FULOONG2F)
|
||||
addiu $a0, $a0, -1
|
||||
b argdone
|
||||
addiu $a1, $a1, 4
|
||||
do_check:
|
||||
lb $t4, 0($t7)
|
||||
beq $t4, $zero, 1f
|
||||
lb $t3, 0($t6)
|
||||
bne $t3, $t4, 2f
|
||||
addiu $t6, $t6, 1
|
||||
b do_check
|
||||
addiu $t7, $t7, 1
|
||||
1:
|
||||
move $s7, $t2
|
||||
2:
|
||||
jr $ra
|
||||
nop
|
||||
argfw:
|
||||
not $s7, $a2
|
||||
cmdlinedone:
|
||||
#endif
|
||||
/* Copy the decompressor. */
|
||||
lui $t1, %hi(base)
|
||||
@ -166,10 +240,9 @@ argdone:
|
||||
subu $a0, $a0, $t0
|
||||
addu $a0, $a0, $s0
|
||||
|
||||
lui $a1, %hi(GRUB_MACHINE_LINK_ADDR)
|
||||
addiu $a1, %lo(GRUB_MACHINE_LINK_ADDR)
|
||||
lw $a2, (GRUB_KERNEL_MACHINE_COMPRESSED_SIZE - BASE_ADDR)($s0)
|
||||
lw $a3, (GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE - BASE_ADDR)($s0)
|
||||
lw $a1, (GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR - BASE_ADDR)($s0)
|
||||
lw $a2, (GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE - BASE_ADDR)($s0)
|
||||
lw $a3, (GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE - BASE_ADDR)($s0)
|
||||
move $s1, $a1
|
||||
|
||||
/* $a0 contains source compressed address, $a1 is destination,
|
||||
|
@ -17,7 +17,6 @@
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/boot.h>
|
||||
#include <grub/machine/boot.h>
|
||||
|
||||
.text
|
||||
@ -29,9 +28,6 @@ pic_base:
|
||||
call boot_continue
|
||||
mov %o4, CIF_REG
|
||||
|
||||
. = _start + GRUB_BOOT_MACHINE_VER_MAJ
|
||||
boot_version: .byte GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR
|
||||
|
||||
/* The offsets to these locations are defined by the
|
||||
* GRUB_BOOT_MACHINE_foo macros in include/grub/sparc/ieee1275/boot.h,
|
||||
* and grub-setup uses this to patch these next three values as needed.
|
||||
@ -44,6 +40,7 @@ boot_version: .byte GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR
|
||||
* 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
|
||||
boot_path:
|
||||
. = _start + GRUB_BOOT_MACHINE_KERNEL_BYTE
|
||||
boot_path_end:
|
||||
|
@ -17,7 +17,6 @@
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/boot.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/offsets.h>
|
||||
|
||||
|
@ -73,15 +73,24 @@ grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||
grub_fatal ("Out of PCI windows.");
|
||||
}
|
||||
|
||||
void *
|
||||
grub_pci_device_map_range_cached (grub_pci_device_t dev,
|
||||
grub_addr_t base, grub_size_t size)
|
||||
{
|
||||
return (void *) (((grub_addr_t) grub_pci_device_map_range (dev, base, size))
|
||||
& ~0x20000000);
|
||||
}
|
||||
|
||||
void
|
||||
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||
volatile void *mem __attribute__ ((unused)),
|
||||
volatile void *mem,
|
||||
grub_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
||||
if (usage_win[i] && addr_win[i]
|
||||
== (((grub_addr_t) mem) & ~GRUB_MACHINE_PCI_WIN_OFFSET_MASK))
|
||||
== (((grub_addr_t) mem | 0x20000000)
|
||||
& ~GRUB_MACHINE_PCI_WIN_OFFSET_MASK))
|
||||
{
|
||||
usage_win[i]--;
|
||||
return;
|
||||
|
@ -21,6 +21,9 @@
|
||||
#include <grub/pci.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/ata.h>
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
#include <grub/machine/kernel.h>
|
||||
#endif
|
||||
|
||||
#include <grub/dl.h>
|
||||
|
||||
@ -94,8 +97,6 @@ grub_cs5536_smbus_wait (grub_port_t smbbase)
|
||||
if (grub_get_time_ms () > start + 40)
|
||||
return grub_error (GRUB_ERR_IO, "SM stalled");
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
@ -217,26 +218,6 @@ grub_cs5536_read_spd (grub_port_t smbbase, grub_uint8_t dev,
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
/* Dump of GPIO connections. FIXME: Remove useless and macroify. */
|
||||
static grub_uint32_t gpiodump[] = {
|
||||
0xffff0000, 0x2ffdd002, 0xffff0000, 0xffff0000,
|
||||
0x2fffd000, 0xffff0000, 0x1000efff, 0xefff1000,
|
||||
0x3ffbc004, 0xffff0000, 0xffff0000, 0xffff0000,
|
||||
0x3ffbc004, 0x3ffbc004, 0xffff0000, 0x00000000,
|
||||
0xffff0000, 0xffff0000, 0x3ffbc004, 0x3f9bc064,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0xffff0000, 0xffff0000, 0xffff0000, 0xffff0000,
|
||||
0xffff0000, 0xffff0000, 0x0000ffff, 0xffff0000,
|
||||
0xefff1000, 0xffff0000, 0xffff0000, 0xffff0000,
|
||||
0xefff1000, 0xefff1000, 0xffff0000, 0x00000000,
|
||||
0xffff0000, 0xffff0000, 0xefff1000, 0xffff0000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
||||
0x00000000, 0x50000000, 0x00000000, 0x00000000,
|
||||
};
|
||||
|
||||
static inline void
|
||||
set_io_space (grub_pci_device_t dev, int num, grub_uint16_t start,
|
||||
grub_uint16_t len)
|
||||
@ -277,17 +258,6 @@ set_p2d (grub_pci_device_t dev, int num, int dest, grub_uint32_t start)
|
||||
void
|
||||
grub_cs5536_init_geode (grub_pci_device_t dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Make sure GPIO is where we expect it to be. */
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_GPIO_BAR,
|
||||
GRUB_CS5536_LBAR_TURN_ON | GRUB_CS5536_LBAR_GPIO);
|
||||
|
||||
/* Setup GPIO. */
|
||||
for (i = 0; i < (int) ARRAY_SIZE (gpiodump); i++)
|
||||
((volatile grub_uint32_t *) (GRUB_MACHINE_PCI_IO_BASE
|
||||
+ GRUB_CS5536_LBAR_GPIO)) [i] = gpiodump[i];
|
||||
|
||||
/* Enable more BARs. */
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_IRQ_MAP_BAR,
|
||||
GRUB_CS5536_LBAR_TURN_ON | GRUB_CS5536_LBAR_IRQ_MAP);
|
||||
@ -299,11 +269,27 @@ grub_cs5536_init_geode (grub_pci_device_t dev)
|
||||
GRUB_CS5536_LBAR_TURN_ON | GRUB_CS5536_LBAR_PM);
|
||||
|
||||
/* Setup DIVIL. */
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_LEG_IO,
|
||||
GRUB_CS5536_MSR_DIVIL_LEG_IO_MODE_X86
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1);
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
switch (grub_arch_machine)
|
||||
{
|
||||
case GRUB_ARCH_MACHINE_YEELOONG:
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_LEG_IO,
|
||||
GRUB_CS5536_MSR_DIVIL_LEG_IO_MODE_X86
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1);
|
||||
break;
|
||||
case GRUB_ARCH_MACHINE_FULOONG2F:
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_LEG_IO,
|
||||
GRUB_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_UART1_COM1
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_MODE_X86
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_PRIMARY_MASK,
|
||||
(~GRUB_CS5536_DIVIL_LPC_INTERRUPTS) & 0xffff);
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_LPC_MASK,
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <grub/dl.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm_private.h>
|
||||
#include <grub/cache.h>
|
||||
|
||||
@ -30,7 +31,21 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
||||
struct grub_pci_dma_chunk *
|
||||
grub_memalign_dma32 (grub_size_t align, grub_size_t size)
|
||||
{
|
||||
void *ret = grub_memalign (align, size);
|
||||
void *ret;
|
||||
if (align < 64)
|
||||
align = 64;
|
||||
size = ALIGN_UP (size, align);
|
||||
ret = grub_memalign (align, size);
|
||||
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
||||
if ((grub_addr_t) ret >> 32)
|
||||
{
|
||||
/* Shouldn't happend since the only platform in this case is
|
||||
x86_64-efi and it skips any regions > 4GiB because
|
||||
of EFI bugs anyway. */
|
||||
grub_error (GRUB_ERR_BUG, "allocation outside 32-bit range");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (!ret)
|
||||
return 0;
|
||||
grub_arch_sync_dma_caches (ret, size);
|
||||
@ -47,7 +62,7 @@ grub_dma_free (struct grub_pci_dma_chunk *ch)
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
volatile void *
|
||||
grub_dma_get_virt (struct grub_pci_dma_chunk *ch)
|
||||
{
|
||||
@ -110,16 +125,6 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook)
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
||||
/* Skip ghosts. */
|
||||
if (id == GRUB_YEELOONG_OHCI_PCIID
|
||||
&& dev.function == GRUB_YEELOONG_OHCI_GHOST_FUNCTION)
|
||||
continue;
|
||||
if (id == GRUB_YEELOONG_EHCI_PCIID
|
||||
&& dev.function == GRUB_YEELOONG_EHCI_GHOST_FUNCTION)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
if (hook (dev, id))
|
||||
return;
|
||||
|
||||
@ -135,3 +140,34 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
grub_uint8_t
|
||||
grub_pci_find_capability (grub_pci_device_t dev, grub_uint8_t cap)
|
||||
{
|
||||
grub_uint8_t pos = 0x34;
|
||||
int ttl = 48;
|
||||
|
||||
while (ttl--)
|
||||
{
|
||||
grub_uint8_t id;
|
||||
grub_pci_address_t addr;
|
||||
|
||||
addr = grub_pci_make_address (dev, pos);
|
||||
pos = grub_pci_read_byte (addr);
|
||||
if (pos < 0x40)
|
||||
break;
|
||||
|
||||
pos &= ~3;
|
||||
|
||||
addr = grub_pci_make_address (dev, pos);
|
||||
id = grub_pci_read_byte (addr);
|
||||
|
||||
if (id == 0xff)
|
||||
break;
|
||||
|
||||
if (id == cap)
|
||||
return pos;
|
||||
pos++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
1917
grub-core/bus/usb/ehci.c
Normal file
1917
grub-core/bus/usb/ehci.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -294,13 +294,15 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
||||
o->hcca_chunk, o->hcca, o->hcca_addr);
|
||||
|
||||
/* Reserve memory for ctrl EDs. */
|
||||
o->ed_ctrl_chunk = grub_memalign_dma32 (16, sizeof(struct grub_ohci_ed)*GRUB_OHCI_CTRL_EDS);
|
||||
o->ed_ctrl_chunk = grub_memalign_dma32 (16, sizeof(struct grub_ohci_ed)
|
||||
* GRUB_OHCI_CTRL_EDS);
|
||||
if (! o->ed_ctrl_chunk)
|
||||
goto fail;
|
||||
o->ed_ctrl = grub_dma_get_virt (o->ed_ctrl_chunk);
|
||||
o->ed_ctrl_addr = grub_dma_get_phys (o->ed_ctrl_chunk);
|
||||
/* Preset EDs */
|
||||
grub_memset ((void*)o->ed_ctrl, 0, sizeof(struct grub_ohci_ed) * GRUB_OHCI_CTRL_EDS);
|
||||
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 */
|
||||
|
||||
@ -308,7 +310,8 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
||||
o->ed_ctrl_chunk, o->ed_ctrl, o->ed_ctrl_addr);
|
||||
|
||||
/* Reserve memory for bulk EDs. */
|
||||
o->ed_bulk_chunk = grub_memalign_dma32 (16, sizeof(struct grub_ohci_ed)*GRUB_OHCI_BULK_EDS);
|
||||
o->ed_bulk_chunk = grub_memalign_dma32 (16, sizeof (struct grub_ohci_ed)
|
||||
* GRUB_OHCI_BULK_EDS);
|
||||
if (! o->ed_bulk_chunk)
|
||||
goto fail;
|
||||
o->ed_bulk = grub_dma_get_virt (o->ed_bulk_chunk);
|
||||
@ -454,10 +457,12 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
||||
|
||||
fail:
|
||||
if (o)
|
||||
grub_dma_free (o->td_chunk);
|
||||
grub_dma_free (o->ed_bulk_chunk);
|
||||
grub_dma_free (o->ed_ctrl_chunk);
|
||||
grub_dma_free (o->hcca_chunk);
|
||||
{
|
||||
grub_dma_free (o->td_chunk);
|
||||
grub_dma_free (o->ed_bulk_chunk);
|
||||
grub_dma_free (o->ed_ctrl_chunk);
|
||||
grub_dma_free (o->hcca_chunk);
|
||||
}
|
||||
grub_free (o);
|
||||
|
||||
return 0;
|
||||
@ -1150,8 +1155,8 @@ grub_ohci_check_transfer (grub_usb_controller_t dev,
|
||||
return parse_halt (dev, transfer, actual);
|
||||
|
||||
/* Finished ED detection */
|
||||
if ( (grub_le_to_cpu32 (cdata->ed_virt->td_head) & ~0xf) ==
|
||||
(grub_le_to_cpu32 (cdata->ed_virt->td_tail) & ~0xf) ) /* Empty ED */
|
||||
if ( (grub_le_to_cpu32 (cdata->ed_virt->td_head) & ~0xfU) ==
|
||||
(grub_le_to_cpu32 (cdata->ed_virt->td_tail) & ~0xfU) ) /* Empty ED */
|
||||
{
|
||||
/* Check the HALT bit */
|
||||
/* It looks like nonsense - it was tested previously...
|
||||
@ -1424,18 +1429,22 @@ static struct grub_usb_controller_dev usb_controller =
|
||||
.detect_dev = grub_ohci_detect_dev
|
||||
};
|
||||
|
||||
static struct grub_preboot *fini_hnd;
|
||||
|
||||
GRUB_MOD_INIT(ohci)
|
||||
{
|
||||
COMPILE_TIME_ASSERT (sizeof (struct grub_ohci_td) == 32);
|
||||
COMPILE_TIME_ASSERT (sizeof (struct grub_ohci_ed) == 16);
|
||||
grub_ohci_inithw ();
|
||||
grub_usb_controller_dev_register (&usb_controller);
|
||||
grub_loader_register_preboot_hook (grub_ohci_fini_hw, grub_ohci_restore_hw,
|
||||
GRUB_LOADER_PREBOOT_HOOK_PRIO_DISK);
|
||||
fini_hnd = grub_loader_register_preboot_hook (grub_ohci_fini_hw,
|
||||
grub_ohci_restore_hw,
|
||||
GRUB_LOADER_PREBOOT_HOOK_PRIO_DISK);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(ohci)
|
||||
{
|
||||
grub_ohci_fini_hw (0);
|
||||
grub_loader_unregister_preboot_hook (fini_hnd);
|
||||
grub_usb_controller_dev_unregister (&usb_controller);
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <grub/mm.h>
|
||||
#include <grub/usb.h>
|
||||
#include <grub/usbserial.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@ -81,6 +82,7 @@ real_config (struct grub_serial_port *port)
|
||||
};
|
||||
const grub_uint16_t stop_bits[] = {
|
||||
[GRUB_SERIAL_STOP_BITS_1] = 0x0000,
|
||||
[GRUB_SERIAL_STOP_BITS_1_5] = 0x0800,
|
||||
[GRUB_SERIAL_STOP_BITS_2] = 0x1000,
|
||||
};
|
||||
|
||||
@ -137,19 +139,24 @@ ftdi_hw_configure (struct grub_serial_port *port,
|
||||
|
||||
divisor = get_divisor (config->speed);
|
||||
if (divisor == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad speed");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("unsupported serial port speed"));
|
||||
|
||||
if (config->parity != GRUB_SERIAL_PARITY_NONE
|
||||
&& config->parity != GRUB_SERIAL_PARITY_ODD
|
||||
&& config->parity != GRUB_SERIAL_PARITY_EVEN)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported parity");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("unsupported serial port parity"));
|
||||
|
||||
if (config->stop_bits != GRUB_SERIAL_STOP_BITS_1
|
||||
&& config->stop_bits != GRUB_SERIAL_STOP_BITS_1_5
|
||||
&& config->stop_bits != GRUB_SERIAL_STOP_BITS_2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported stop bits");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("unsupported serial port stop bits number"));
|
||||
|
||||
if (config->word_len < 5 || config->word_len > 8)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported word length");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("unsupported serial port word length"));
|
||||
|
||||
port->config = *config;
|
||||
port->configured = 0;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <grub/mm.h>
|
||||
#include <grub/usb.h>
|
||||
#include <grub/usbserial.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@ -41,6 +42,7 @@ is_speed_supported (unsigned int speed)
|
||||
|
||||
#define GRUB_PL2303_REQUEST_SET_CONFIG 0x20
|
||||
#define GRUB_PL2303_STOP_BITS_1 0x0
|
||||
#define GRUB_PL2303_STOP_BITS_1_5 0x1
|
||||
#define GRUB_PL2303_STOP_BITS_2 0x2
|
||||
|
||||
#define GRUB_PL2303_PARITY_NONE 0
|
||||
@ -96,6 +98,8 @@ real_config (struct grub_serial_port *port)
|
||||
|
||||
if (port->config.stop_bits == GRUB_SERIAL_STOP_BITS_2)
|
||||
config_pl2303.stop_bits = GRUB_PL2303_STOP_BITS_2;
|
||||
else if (port->config.stop_bits == GRUB_SERIAL_STOP_BITS_1_5)
|
||||
config_pl2303.stop_bits = GRUB_PL2303_STOP_BITS_1_5;
|
||||
else
|
||||
config_pl2303.stop_bits = GRUB_PL2303_STOP_BITS_1;
|
||||
|
||||
@ -150,19 +154,24 @@ pl2303_hw_configure (struct grub_serial_port *port,
|
||||
struct grub_serial_config *config)
|
||||
{
|
||||
if (!is_speed_supported (config->speed))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "bad speed");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("unsupported serial port speed"));
|
||||
|
||||
if (config->parity != GRUB_SERIAL_PARITY_NONE
|
||||
&& config->parity != GRUB_SERIAL_PARITY_ODD
|
||||
&& config->parity != GRUB_SERIAL_PARITY_EVEN)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported parity");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("unsupported serial port parity"));
|
||||
|
||||
if (config->stop_bits != GRUB_SERIAL_STOP_BITS_1
|
||||
&& config->stop_bits != GRUB_SERIAL_STOP_BITS_1_5
|
||||
&& config->stop_bits != GRUB_SERIAL_STOP_BITS_2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported stop bits");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("unsupported serial port stop bits number"));
|
||||
|
||||
if (config->word_len < 5 || config->word_len > 8)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unsupported word length");
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
N_("unsupported serial port word length"));
|
||||
|
||||
port->config = *config;
|
||||
port->configured = 0;
|
||||
|
@ -23,8 +23,9 @@
|
||||
#include <grub/usb.h>
|
||||
#include <grub/usbtrans.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/i386/io.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/cpu/pci.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@ -36,11 +37,33 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
||||
typedef enum
|
||||
{
|
||||
GRUB_UHCI_REG_USBCMD = 0x00,
|
||||
GRUB_UHCI_REG_USBINTR = 0x04,
|
||||
GRUB_UHCI_REG_FLBASEADD = 0x08,
|
||||
GRUB_UHCI_REG_PORTSC1 = 0x10,
|
||||
GRUB_UHCI_REG_PORTSC2 = 0x12
|
||||
GRUB_UHCI_REG_PORTSC2 = 0x12,
|
||||
GRUB_UHCI_REG_USBLEGSUP = 0xc0
|
||||
} grub_uhci_reg_t;
|
||||
|
||||
/* R/WC legacy support bits */
|
||||
#define GRUB_UHCI_LEGSUP_END_A20GATE (1 << 15)
|
||||
#define GRUB_UHCI_TRAP_BY_64H_WSTAT (1 << 11)
|
||||
#define GRUB_UHCI_TRAP_BY_64H_RSTAT (1 << 10)
|
||||
#define GRUB_UHCI_TRAP_BY_60H_WSTAT (1 << 9)
|
||||
#define GRUB_UHCI_TRAP_BY_60H_RSTAT (1 << 8)
|
||||
|
||||
/* Reset all legacy support - clear all R/WC bits and all R/W bits */
|
||||
#define GRUB_UHCI_RESET_LEGSUP_SMI ( GRUB_UHCI_LEGSUP_END_A20GATE \
|
||||
| GRUB_UHCI_TRAP_BY_64H_WSTAT \
|
||||
| GRUB_UHCI_TRAP_BY_64H_RSTAT \
|
||||
| GRUB_UHCI_TRAP_BY_60H_WSTAT \
|
||||
| GRUB_UHCI_TRAP_BY_60H_RSTAT )
|
||||
|
||||
/* Some UHCI commands */
|
||||
#define GRUB_UHCI_CMD_RUN_STOP (1 << 0)
|
||||
#define GRUB_UHCI_CMD_HCRESET (1 << 1)
|
||||
#define GRUB_UHCI_CMD_MAXP (1 << 7)
|
||||
|
||||
/* Important bits in structures */
|
||||
#define GRUB_UHCI_LINK_TERMINATE 1
|
||||
#define GRUB_UHCI_LINK_QUEUE_HEAD 2
|
||||
|
||||
@ -103,13 +126,19 @@ typedef volatile struct grub_uhci_qh *grub_uhci_qh_t;
|
||||
struct grub_uhci
|
||||
{
|
||||
int iobase;
|
||||
grub_uint32_t *framelist;
|
||||
volatile grub_uint32_t *framelist_virt;
|
||||
grub_uint32_t framelist_phys;
|
||||
struct grub_pci_dma_chunk *framelist_chunk;
|
||||
|
||||
/* N_QH Queue Heads. */
|
||||
grub_uhci_qh_t qh;
|
||||
struct grub_pci_dma_chunk *qh_chunk;
|
||||
volatile grub_uhci_qh_t qh_virt;
|
||||
grub_uint32_t qh_phys;
|
||||
|
||||
/* N_TD Transfer Descriptors. */
|
||||
grub_uhci_td_t td;
|
||||
struct grub_pci_dma_chunk *td_chunk;
|
||||
volatile grub_uhci_td_t td_virt;
|
||||
grub_uint32_t td_phys;
|
||||
|
||||
/* Free Transfer Descriptors. */
|
||||
grub_uhci_td_t tdfree;
|
||||
@ -181,6 +210,11 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
||||
if (class != 0x0c || subclass != 0x03 || interf != 0x00)
|
||||
return 0;
|
||||
|
||||
/* Set bus master - needed for coreboot or broken BIOSes */
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
|
||||
grub_pci_write_word(addr,
|
||||
GRUB_PCI_COMMAND_BUS_MASTER | grub_pci_read_word(addr));
|
||||
|
||||
/* Determine IO base address. */
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG4);
|
||||
base = grub_pci_read (addr);
|
||||
@ -195,97 +229,89 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
||||
|
||||
u->iobase = base & GRUB_UHCI_IOMASK;
|
||||
|
||||
/* Reset PIRQ and SMI */
|
||||
addr = grub_pci_make_address (dev, GRUB_UHCI_REG_USBLEGSUP);
|
||||
grub_pci_write_word(addr, GRUB_UHCI_RESET_LEGSUP_SMI);
|
||||
/* Reset the HC */
|
||||
grub_uhci_writereg16(u, GRUB_UHCI_REG_USBCMD, GRUB_UHCI_CMD_HCRESET);
|
||||
grub_millisleep(5);
|
||||
/* Disable interrupts and commands (just to be safe) */
|
||||
grub_uhci_writereg16(u, GRUB_UHCI_REG_USBINTR, 0);
|
||||
/* Finish HC reset, HC remains disabled */
|
||||
grub_uhci_writereg16(u, GRUB_UHCI_REG_USBCMD, 0);
|
||||
/* Read back to be sure PCI write is done */
|
||||
grub_uhci_readreg16(u, GRUB_UHCI_REG_USBCMD);
|
||||
|
||||
/* Reserve a page for the frame list. */
|
||||
u->framelist = grub_memalign (4096, 4096);
|
||||
if (! u->framelist)
|
||||
u->framelist_chunk = grub_memalign_dma32 (4096, 4096);
|
||||
if (! u->framelist_chunk)
|
||||
goto fail;
|
||||
u->framelist_virt = grub_dma_get_virt (u->framelist_chunk);
|
||||
u->framelist_phys = grub_dma_get_phys (u->framelist_chunk);
|
||||
|
||||
grub_dprintf ("uhci", "class=0x%02x 0x%02x interface 0x%02x base=0x%x framelist=%p\n",
|
||||
class, subclass, interf, u->iobase, u->framelist);
|
||||
|
||||
/* The framelist pointer of UHCI is only 32 bits, make sure this
|
||||
code works on on 64 bits architectures. */
|
||||
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
||||
if ((grub_uint64_t) u->framelist >> 32)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"allocated frame list memory not <4GB");
|
||||
goto fail;
|
||||
}
|
||||
#endif
|
||||
grub_dprintf ("uhci",
|
||||
"class=0x%02x 0x%02x interface 0x%02x base=0x%x framelist=%p\n",
|
||||
class, subclass, interf, u->iobase, u->framelist_virt);
|
||||
|
||||
/* The QH pointer of UHCI is only 32 bits, make sure this
|
||||
code works on on 64 bits architectures. */
|
||||
u->qh = (grub_uhci_qh_t) grub_memalign (4096, sizeof(struct grub_uhci_qh)*N_QH);
|
||||
if (! u->qh)
|
||||
u->qh_chunk = grub_memalign_dma32 (4096, sizeof(struct grub_uhci_qh) * N_QH);
|
||||
if (! u->qh_chunk)
|
||||
goto fail;
|
||||
|
||||
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
||||
if ((grub_uint64_t) u->qh >> 32)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "allocated QH memory not <4GB");
|
||||
goto fail;
|
||||
}
|
||||
#endif
|
||||
u->qh_virt = grub_dma_get_virt (u->qh_chunk);
|
||||
u->qh_phys = grub_dma_get_phys (u->qh_chunk);
|
||||
|
||||
/* The TD pointer of UHCI is only 32 bits, make sure this
|
||||
code works on on 64 bits architectures. */
|
||||
u->td = (grub_uhci_td_t) grub_memalign (4096, sizeof(struct grub_uhci_td)*N_TD);
|
||||
if (! u->td)
|
||||
u->td_chunk = grub_memalign_dma32 (4096, sizeof(struct grub_uhci_td) * N_TD);
|
||||
if (! u->td_chunk)
|
||||
goto fail;
|
||||
|
||||
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
||||
if ((grub_uint64_t) u->td >> 32)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "allocated TD memory not <4GB");
|
||||
goto fail;
|
||||
}
|
||||
#endif
|
||||
u->td_virt = grub_dma_get_virt (u->td_chunk);
|
||||
u->td_phys = grub_dma_get_phys (u->td_chunk);
|
||||
|
||||
grub_dprintf ("uhci", "QH=%p, TD=%p\n",
|
||||
u->qh, u->td);
|
||||
u->qh_virt, u->td_virt);
|
||||
|
||||
/* Link all Transfer Descriptors in a list of available Transfer
|
||||
Descriptors. */
|
||||
for (i = 0; i < N_TD; i++)
|
||||
u->td[i].linkptr = (grub_uint32_t) (grub_addr_t) &u->td[i + 1];
|
||||
u->td[N_TD - 2].linkptr = 0;
|
||||
u->tdfree = u->td;
|
||||
|
||||
/* Make sure UHCI is disabled! */
|
||||
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, 0);
|
||||
u->td_virt[i].linkptr = u->td_phys + (i + 1) * sizeof(struct grub_uhci_td);
|
||||
u->td_virt[N_TD - 2].linkptr = 0;
|
||||
u->tdfree = u->td_virt;
|
||||
|
||||
/* Setup the frame list pointers. Since no isochronous transfers
|
||||
are and will be supported, they all point to the (same!) queue
|
||||
head. */
|
||||
fp = (grub_uint32_t) (grub_addr_t) u->qh & (~15);
|
||||
fp = u->qh_phys & (~15);
|
||||
/* Mark this as a queue head. */
|
||||
fp |= 2;
|
||||
for (i = 0; i < 1024; i++)
|
||||
u->framelist[i] = fp;
|
||||
u->framelist_virt[i] = fp;
|
||||
/* Program the framelist address into the UHCI controller. */
|
||||
grub_uhci_writereg32 (u, GRUB_UHCI_REG_FLBASEADD,
|
||||
(grub_uint32_t) (grub_addr_t) u->framelist);
|
||||
grub_uhci_writereg32 (u, GRUB_UHCI_REG_FLBASEADD, u->framelist_phys);
|
||||
|
||||
/* Make the Queue Heads point to each other. */
|
||||
for (i = 0; i < N_QH; i++)
|
||||
{
|
||||
/* Point to the next QH. */
|
||||
u->qh[i].linkptr = (grub_uint32_t) (grub_addr_t) (&u->qh[i + 1]) & (~15);
|
||||
u->qh_virt[i].linkptr = ((u->qh_phys
|
||||
+ (i + 1) * sizeof(struct grub_uhci_qh))
|
||||
& (~15));
|
||||
|
||||
/* This is a QH. */
|
||||
u->qh[i].linkptr |= GRUB_UHCI_LINK_QUEUE_HEAD;
|
||||
u->qh_virt[i].linkptr |= GRUB_UHCI_LINK_QUEUE_HEAD;
|
||||
|
||||
/* For the moment, do not point to a Transfer Descriptor. These
|
||||
are set at transfer time, so just terminate it. */
|
||||
u->qh[i].elinkptr = 1;
|
||||
u->qh_virt[i].elinkptr = 1;
|
||||
}
|
||||
|
||||
/* The last Queue Head should terminate. */
|
||||
u->qh[N_QH - 1].linkptr = 1;
|
||||
u->qh_virt[N_QH - 1].linkptr = 1;
|
||||
|
||||
/* Enable UHCI again. */
|
||||
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, 1 | (1 << 7));
|
||||
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD,
|
||||
GRUB_UHCI_CMD_RUN_STOP | GRUB_UHCI_CMD_MAXP);
|
||||
|
||||
/* UHCI is initialized and ready for transfers. */
|
||||
grub_dprintf ("uhci", "UHCI initialized\n");
|
||||
@ -314,8 +340,8 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
||||
fail:
|
||||
if (u)
|
||||
{
|
||||
grub_free ((void *) u->qh);
|
||||
grub_free (u->framelist);
|
||||
grub_dma_free (u->qh_chunk);
|
||||
grub_dma_free (u->framelist_chunk);
|
||||
}
|
||||
grub_free (u);
|
||||
|
||||
@ -338,7 +364,7 @@ grub_alloc_td (struct grub_uhci *u)
|
||||
return NULL;
|
||||
|
||||
ret = u->tdfree;
|
||||
u->tdfree = (grub_uhci_td_t) (grub_addr_t) u->tdfree->linkptr;
|
||||
u->tdfree = grub_dma_phys2virt (u->tdfree->linkptr, u->td_chunk);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -346,7 +372,7 @@ grub_alloc_td (struct grub_uhci *u)
|
||||
static void
|
||||
grub_free_td (struct grub_uhci *u, grub_uhci_td_t td)
|
||||
{
|
||||
td->linkptr = (grub_uint32_t) (grub_addr_t) u->tdfree;
|
||||
td->linkptr = grub_dma_virt2phys (u->tdfree, u->td_chunk);
|
||||
u->tdfree = td;
|
||||
}
|
||||
|
||||
@ -356,7 +382,7 @@ grub_free_queue (struct grub_uhci *u, grub_uhci_qh_t qh, grub_uhci_td_t td,
|
||||
{
|
||||
int i; /* Index of TD in transfer */
|
||||
|
||||
u->qh_busy[qh - u->qh] = 0;
|
||||
u->qh_busy[qh - u->qh_virt] = 0;
|
||||
|
||||
*actual = 0;
|
||||
|
||||
@ -373,7 +399,7 @@ grub_free_queue (struct grub_uhci *u, grub_uhci_qh_t qh, grub_uhci_td_t td,
|
||||
|
||||
/* Unlink the queue. */
|
||||
tdprev = td;
|
||||
td = (grub_uhci_td_t) (grub_addr_t) td->linkptr2;
|
||||
td = grub_dma_phys2virt (td->linkptr2, u->td_chunk);
|
||||
|
||||
/* Free the TD. */
|
||||
grub_free_td (u, tdprev);
|
||||
@ -401,7 +427,7 @@ grub_alloc_qh (struct grub_uhci *u,
|
||||
if (!u->qh_busy[i])
|
||||
break;
|
||||
}
|
||||
qh = &u->qh[i];
|
||||
qh = &u->qh_virt[i];
|
||||
if (i == N_QH)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
@ -409,7 +435,7 @@ grub_alloc_qh (struct grub_uhci *u,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
u->qh_busy[qh - u->qh] = 1;
|
||||
u->qh_busy[qh - u->qh_virt] = 1;
|
||||
|
||||
return qh;
|
||||
}
|
||||
@ -506,8 +532,11 @@ grub_uhci_setup_transfer (grub_usb_controller_t dev,
|
||||
{
|
||||
grub_size_t actual = 0;
|
||||
/* Terminate and free. */
|
||||
td_prev->linkptr2 = 0;
|
||||
td_prev->linkptr = 1;
|
||||
if (td_prev)
|
||||
{
|
||||
td_prev->linkptr2 = 0;
|
||||
td_prev->linkptr = 1;
|
||||
}
|
||||
|
||||
if (cdata->td_first)
|
||||
grub_free_queue (u, cdata->qh, cdata->td_first, NULL, &actual);
|
||||
@ -520,8 +549,8 @@ grub_uhci_setup_transfer (grub_usb_controller_t dev,
|
||||
cdata->td_first = td;
|
||||
else
|
||||
{
|
||||
td_prev->linkptr2 = (grub_uint32_t) (grub_addr_t) td;
|
||||
td_prev->linkptr = (grub_uint32_t) (grub_addr_t) td;
|
||||
td_prev->linkptr2 = grub_dma_virt2phys (td, u->td_chunk);
|
||||
td_prev->linkptr = grub_dma_virt2phys (td, u->td_chunk);
|
||||
td_prev->linkptr |= 4;
|
||||
}
|
||||
td_prev = td;
|
||||
@ -533,7 +562,7 @@ grub_uhci_setup_transfer (grub_usb_controller_t dev,
|
||||
|
||||
/* Link it into the queue and terminate. Now the transaction can
|
||||
take place. */
|
||||
cdata->qh->elinkptr = (grub_uint32_t) (grub_addr_t) cdata->td_first;
|
||||
cdata->qh->elinkptr = grub_dma_virt2phys (cdata->td_first, u->td_chunk);
|
||||
|
||||
grub_dprintf ("uhci", "initiate transaction\n");
|
||||
|
||||
@ -553,7 +582,7 @@ grub_uhci_check_transfer (grub_usb_controller_t dev,
|
||||
|
||||
*actual = 0;
|
||||
|
||||
errtd = (grub_uhci_td_t) (grub_addr_t) (cdata->qh->elinkptr & ~0x0f);
|
||||
errtd = grub_dma_phys2virt (cdata->qh->elinkptr & ~0x0f, u->qh_chunk);
|
||||
|
||||
grub_dprintf ("uhci", ">t status=0x%02x data=0x%02x td=%p\n",
|
||||
errtd->ctrl_status, errtd->buffer & (~15), errtd);
|
||||
|
@ -185,6 +185,12 @@ grub_usb_device_initialize (grub_usb_device_t dev)
|
||||
for (i = 0; i < 8; i++)
|
||||
dev->config[i].descconf = NULL;
|
||||
|
||||
if (descdev->configcnt == 0)
|
||||
{
|
||||
err = GRUB_USB_ERR_BADDEVICE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (i = 0; i < descdev->configcnt; i++)
|
||||
{
|
||||
int pos;
|
||||
@ -334,7 +340,7 @@ grub_usb_register_attach_hook_class (struct grub_usb_attach_desc *desc)
|
||||
void
|
||||
grub_usb_unregister_attach_hook_class (struct grub_usb_attach_desc *desc)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&attach_hooks), GRUB_AS_LIST (desc));
|
||||
grub_list_remove (GRUB_AS_LIST (desc));
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,7 +44,9 @@ static struct grub_usb_hub *hubs;
|
||||
/* Add a device that currently has device number 0 and resides on
|
||||
CONTROLLER, the Hub reported that the device speed is SPEED. */
|
||||
static grub_usb_device_t
|
||||
grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed)
|
||||
grub_usb_hub_add_dev (grub_usb_controller_t controller,
|
||||
grub_usb_speed_t speed,
|
||||
int port, int hubaddr)
|
||||
{
|
||||
grub_usb_device_t dev;
|
||||
int i;
|
||||
@ -56,6 +58,8 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed)
|
||||
|
||||
dev->controller = *controller;
|
||||
dev->speed = speed;
|
||||
dev->port = port;
|
||||
dev->hubaddr = hubaddr;
|
||||
|
||||
err = grub_usb_device_initialize (dev);
|
||||
if (err)
|
||||
@ -97,6 +101,11 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller, grub_usb_speed_t speed)
|
||||
dev->initialized = 1;
|
||||
grub_usb_devs[i] = dev;
|
||||
|
||||
grub_dprintf ("usb", "Added new usb device: %p, addr=%d\n",
|
||||
dev, i);
|
||||
grub_dprintf ("usb", "speed=%d, port=%d, hubaddr=%d\n",
|
||||
speed, port, hubaddr);
|
||||
|
||||
/* Wait "recovery interval", spec. says 2ms */
|
||||
grub_millisleep (2);
|
||||
|
||||
@ -158,11 +167,13 @@ grub_usb_add_hub (grub_usb_device_t dev)
|
||||
if ((endp->endp_addr & 128) && grub_usb_get_ep_type(endp)
|
||||
== GRUB_USB_EP_INTERRUPT)
|
||||
{
|
||||
grub_size_t len;
|
||||
dev->hub_endpoint = endp;
|
||||
len = endp->maxpacket;
|
||||
if (len > sizeof (dev->statuschange))
|
||||
len = sizeof (dev->statuschange);
|
||||
dev->hub_transfer
|
||||
= grub_usb_bulk_read_background (dev, endp->endp_addr,
|
||||
grub_min (endp->maxpacket,
|
||||
sizeof (dev->statuschange)),
|
||||
= grub_usb_bulk_read_background (dev, endp->endp_addr, len,
|
||||
(char *) &dev->statuschange);
|
||||
break;
|
||||
}
|
||||
@ -215,8 +226,10 @@ attach_root_port (struct grub_usb_hub *hub, int portno,
|
||||
return;
|
||||
hub->controller->dev->pending_reset = grub_get_time_ms () + 5000;
|
||||
|
||||
grub_millisleep (10);
|
||||
|
||||
/* Enable the port and create a device. */
|
||||
dev = grub_usb_hub_add_dev (hub->controller, speed);
|
||||
dev = grub_usb_hub_add_dev (hub->controller, speed, portno, 0);
|
||||
hub->controller->dev->pending_reset = 0;
|
||||
if (! dev)
|
||||
return;
|
||||
@ -312,7 +325,7 @@ poll_nonroot_hub (grub_usb_device_t dev)
|
||||
grub_usb_err_t err;
|
||||
unsigned i;
|
||||
grub_uint8_t changed;
|
||||
grub_size_t actual;
|
||||
grub_size_t actual, len;
|
||||
int j, total;
|
||||
|
||||
if (!dev->hub_transfer)
|
||||
@ -325,10 +338,11 @@ poll_nonroot_hub (grub_usb_device_t dev)
|
||||
|
||||
changed = dev->statuschange;
|
||||
|
||||
len = dev->hub_endpoint->maxpacket;
|
||||
if (len > sizeof (dev->statuschange))
|
||||
len = sizeof (dev->statuschange);
|
||||
dev->hub_transfer
|
||||
= grub_usb_bulk_read_background (dev, dev->hub_endpoint->endp_addr,
|
||||
grub_min (dev->hub_endpoint->maxpacket,
|
||||
sizeof (dev->statuschange)),
|
||||
= grub_usb_bulk_read_background (dev, dev->hub_endpoint->endp_addr, len,
|
||||
(char *) &dev->statuschange);
|
||||
|
||||
if (err || actual == 0 || changed == 0)
|
||||
@ -350,7 +364,7 @@ poll_nonroot_hub (grub_usb_device_t dev)
|
||||
GRUB_USB_REQ_GET_STATUS,
|
||||
0, i, sizeof (status), (char *) &status);
|
||||
|
||||
grub_printf ("dev = %p, i = %d, status = %08x\n",
|
||||
grub_dprintf ("usb", "dev = %p, i = %d, status = %08x\n",
|
||||
dev, i, status);
|
||||
|
||||
if (err)
|
||||
@ -470,7 +484,7 @@ poll_nonroot_hub (grub_usb_device_t dev)
|
||||
grub_millisleep (10);
|
||||
|
||||
/* Add the device and assign a device address to it. */
|
||||
next_dev = grub_usb_hub_add_dev (&dev->controller, speed);
|
||||
next_dev = grub_usb_hub_add_dev (&dev->controller, speed, i, dev->addr);
|
||||
dev->controller.dev->pending_reset = 0;
|
||||
if (! next_dev)
|
||||
continue;
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include <grub/efi/api.h>
|
||||
#endif
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const struct grub_arg_option options[] = {
|
||||
@ -41,8 +43,8 @@ static const struct grub_arg_option options[] = {
|
||||
0, ARG_TYPE_STRING},
|
||||
{"load-only", 'n', 0,
|
||||
N_("Load only tables specified by comma-separated list."), 0, ARG_TYPE_STRING},
|
||||
{"v1", '1', 0, N_("Expose v1 tables."), 0, ARG_TYPE_NONE},
|
||||
{"v2", '2', 0, N_("Expose v2 and v3 tables."), 0, ARG_TYPE_NONE},
|
||||
{"v1", '1', 0, N_("Export version 1 tables to the OS."), 0, ARG_TYPE_NONE},
|
||||
{"v2", '2', 0, N_("Export version 2 and version 3 tables to the OS."), 0, ARG_TYPE_NONE},
|
||||
{"oemid", 'o', 0, N_("Set OEMID of RSDP, XSDT and RSDT."), 0, ARG_TYPE_STRING},
|
||||
{"oemtable", 't', 0,
|
||||
N_("Set OEMTABLE ID of RSDP, XSDT and RSDT."), 0, ARG_TYPE_STRING},
|
||||
@ -52,8 +54,9 @@ static const struct grub_arg_option options[] = {
|
||||
N_("Set creator field of RSDP, XSDT and RSDT."), 0, ARG_TYPE_STRING},
|
||||
{"oemtablecreatorrev", 'd', 0,
|
||||
N_("Set creator revision of RSDP, XSDT and RSDT."), 0, ARG_TYPE_INT},
|
||||
{"no-ebda", 'e', 0, N_("Don't update EBDA. May fix failures or hangs on some."
|
||||
" BIOSes but makes it ineffective with OS not receiving RSDP from GRUB."),
|
||||
/* TRANSLATORS: "hangs" here is a noun, not a verb. */
|
||||
{"no-ebda", 'e', 0, N_("Don't update EBDA. May fix failures or hangs on some "
|
||||
"BIOSes but makes it ineffective with OS not receiving RSDP from GRUB."),
|
||||
0, ARG_TYPE_NONE},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
@ -138,6 +141,7 @@ iszero (grub_uint8_t *reg, int size)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined (__i386__) || defined (__x86_64__)
|
||||
grub_err_t
|
||||
grub_acpi_create_ebda (void)
|
||||
{
|
||||
@ -165,7 +169,7 @@ grub_acpi_create_ebda (void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ebda = (grub_uint8_t *) UINT_TO_PTR ((*((grub_uint16_t *)0x40e)) << 4);
|
||||
ebda = (grub_uint8_t *) (grub_addr_t) ((*((grub_uint16_t *)0x40e)) << 4);
|
||||
ebda_kb_len = *(grub_uint16_t *) ebda;
|
||||
if (! ebda || ebda_kb_len > 16)
|
||||
ebda_kb_len = 0;
|
||||
@ -173,14 +177,14 @@ grub_acpi_create_ebda (void)
|
||||
|
||||
/* FIXME: use low-memory mm allocation once it's available. */
|
||||
grub_mmap_iterate (find_hook);
|
||||
targetebda = (grub_uint8_t *) UINT_TO_PTR (highestlow);
|
||||
targetebda = (grub_uint8_t *) (grub_addr_t) highestlow;
|
||||
grub_dprintf ("acpi", "creating ebda @%llx\n",
|
||||
(unsigned long long) highestlow);
|
||||
if (! highestlow)
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't find space for the new EBDA");
|
||||
|
||||
mmapregion = grub_mmap_register (PTR_TO_UINT64 (targetebda), ebda_len,
|
||||
mmapregion = grub_mmap_register ((grub_addr_t) targetebda, ebda_len,
|
||||
GRUB_MEMORY_RESERVED);
|
||||
if (! mmapregion)
|
||||
return grub_errno;
|
||||
@ -297,6 +301,7 @@ grub_acpi_create_ebda (void)
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Create tables common to ACPIv1 and ACPIv2+ */
|
||||
static void
|
||||
@ -328,13 +333,13 @@ setup_common_tables (void)
|
||||
if (grub_memcmp (fadt->hdr.signature, GRUB_ACPI_FADT_SIGNATURE,
|
||||
sizeof (fadt->hdr.signature)) == 0)
|
||||
{
|
||||
fadt->dsdt_addr = PTR_TO_UINT32 (table_dsdt);
|
||||
fadt->dsdt_addr = (grub_addr_t) table_dsdt;
|
||||
fadt->facs_addr = facs_addr;
|
||||
|
||||
/* Does a revision 2 exist at all? */
|
||||
if (fadt->hdr.revision >= 3)
|
||||
{
|
||||
fadt->dsdt_xaddr = PTR_TO_UINT64 (table_dsdt);
|
||||
fadt->dsdt_xaddr = (grub_addr_t) table_dsdt;
|
||||
fadt->facs_xaddr = facs_addr;
|
||||
}
|
||||
|
||||
@ -365,7 +370,7 @@ setup_common_tables (void)
|
||||
rsdt->creator_rev = root_creator_rev;
|
||||
|
||||
for (cur = acpi_tables; cur; cur = cur->next)
|
||||
*(rsdt_entry++) = PTR_TO_UINT32 (cur->addr);
|
||||
*(rsdt_entry++) = (grub_addr_t) cur->addr;
|
||||
|
||||
/* Recompute checksum. */
|
||||
rsdt->checksum = 0;
|
||||
@ -383,7 +388,7 @@ setv1table (void)
|
||||
sizeof (rsdpv1_new->signature));
|
||||
grub_memcpy (&(rsdpv1_new->oemid), root_oemid, sizeof (rsdpv1_new->oemid));
|
||||
rsdpv1_new->revision = 0;
|
||||
rsdpv1_new->rsdt_addr = PTR_TO_UINT32 (rsdt_addr);
|
||||
rsdpv1_new->rsdt_addr = (grub_addr_t) rsdt_addr;
|
||||
rsdpv1_new->checksum = 0;
|
||||
rsdpv1_new->checksum = 1 + ~grub_byte_checksum (rsdpv1_new,
|
||||
sizeof (*rsdpv1_new));
|
||||
@ -408,7 +413,7 @@ setv2table (void)
|
||||
|
||||
xsdt_entry = (grub_uint64_t *)(xsdt + 1);
|
||||
for (cur = acpi_tables; cur; cur = cur->next)
|
||||
*(xsdt_entry++) = PTR_TO_UINT64 (cur->addr);
|
||||
*(xsdt_entry++) = (grub_addr_t) cur->addr;
|
||||
grub_memcpy (&(xsdt->signature), "XSDT", 4);
|
||||
xsdt->length = sizeof (struct grub_acpi_table_header) + 8 * numoftables;
|
||||
xsdt->revision = 1;
|
||||
@ -428,12 +433,12 @@ setv2table (void)
|
||||
grub_memcpy (&(rsdpv2_new->rsdpv1.oemid), root_oemid,
|
||||
sizeof (rsdpv2_new->rsdpv1.oemid));
|
||||
rsdpv2_new->rsdpv1.revision = rev2;
|
||||
rsdpv2_new->rsdpv1.rsdt_addr = PTR_TO_UINT32 (rsdt_addr);
|
||||
rsdpv2_new->rsdpv1.rsdt_addr = (grub_addr_t) rsdt_addr;
|
||||
rsdpv2_new->rsdpv1.checksum = 0;
|
||||
rsdpv2_new->rsdpv1.checksum = 1 + ~grub_byte_checksum
|
||||
(&(rsdpv2_new->rsdpv1), sizeof (rsdpv2_new->rsdpv1));
|
||||
rsdpv2_new->length = sizeof (*rsdpv2_new);
|
||||
rsdpv2_new->xsdt_addr = PTR_TO_UINT64 (xsdt);
|
||||
rsdpv2_new->xsdt_addr = (grub_addr_t) xsdt;
|
||||
rsdpv2_new->checksum = 0;
|
||||
rsdpv2_new->checksum = 1 + ~grub_byte_checksum (rsdpv2_new,
|
||||
rsdpv2_new->length);
|
||||
@ -463,7 +468,6 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
||||
struct grub_arg_list *state = ctxt->state;
|
||||
struct grub_acpi_rsdp_v10 *rsdp;
|
||||
struct efiemu_acpi_table *cur, *t;
|
||||
grub_err_t err;
|
||||
int i, mmapregion;
|
||||
int numoftables;
|
||||
|
||||
@ -506,7 +510,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
||||
/* Set revision variables to replicate the same version as host. */
|
||||
rev1 = ! rsdp->revision;
|
||||
rev2 = rsdp->revision;
|
||||
rsdt = (struct grub_acpi_table_header *) UINT_TO_PTR (rsdp->rsdt_addr);
|
||||
rsdt = (struct grub_acpi_table_header *) (grub_addr_t) rsdp->rsdt_addr;
|
||||
/* Load host tables. */
|
||||
for (entry_ptr = (grub_uint32_t *) (rsdt + 1);
|
||||
entry_ptr < (grub_uint32_t *) (((grub_uint8_t *) rsdt)
|
||||
@ -516,7 +520,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
||||
char signature[5];
|
||||
struct efiemu_acpi_table *table;
|
||||
struct grub_acpi_table_header *curtable
|
||||
= (struct grub_acpi_table_header *) UINT_TO_PTR (*entry_ptr);
|
||||
= (struct grub_acpi_table_header *) (grub_addr_t) *entry_ptr;
|
||||
signature[4] = 0;
|
||||
for (i = 0; i < 4;i++)
|
||||
signature[i] = grub_tolower (curtable->signature[i]);
|
||||
@ -540,7 +544,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
||||
|
||||
/* Load DSDT if not excluded. */
|
||||
dsdt = (struct grub_acpi_table_header *)
|
||||
UINT_TO_PTR (fadt->dsdt_addr);
|
||||
(grub_addr_t) fadt->dsdt_addr;
|
||||
if (dsdt && (! exclude || ! grub_strword (exclude, "dsdt"))
|
||||
&& (! load_only || grub_strword (load_only, "dsdt"))
|
||||
&& dsdt->length >= sizeof (*dsdt))
|
||||
@ -552,8 +556,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
||||
free_tables ();
|
||||
grub_free (exclude);
|
||||
grub_free (load_only);
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't allocate table");
|
||||
return grub_errno;
|
||||
}
|
||||
grub_memcpy (table_dsdt, dsdt, dsdt->length);
|
||||
}
|
||||
@ -579,8 +582,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
||||
free_tables ();
|
||||
grub_free (exclude);
|
||||
grub_free (load_only);
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't allocate table structure");
|
||||
return grub_errno;
|
||||
}
|
||||
table->size = curtable->length;
|
||||
table->addr = grub_malloc (table->size);
|
||||
@ -588,8 +590,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
||||
if (! table->addr)
|
||||
{
|
||||
free_tables ();
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't allocate table");
|
||||
return grub_errno;
|
||||
}
|
||||
table->next = acpi_tables;
|
||||
acpi_tables = table;
|
||||
@ -632,7 +633,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
||||
if (! file)
|
||||
{
|
||||
free_tables ();
|
||||
return grub_error (GRUB_ERR_BAD_OS, "couldn't open file %s", args[i]);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
size = grub_file_size (file);
|
||||
@ -640,7 +641,8 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
||||
{
|
||||
grub_file_close (file);
|
||||
free_tables ();
|
||||
return grub_error (GRUB_ERR_BAD_OS, "file %s is too small", args[i]);
|
||||
return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
|
||||
args[i]);
|
||||
}
|
||||
|
||||
buf = (char *) grub_malloc (size);
|
||||
@ -648,15 +650,17 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
||||
{
|
||||
grub_file_close (file);
|
||||
free_tables ();
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't read file %s", args[i]);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
if (grub_file_read (file, buf, size) != (int) size)
|
||||
{
|
||||
grub_file_close (file);
|
||||
free_tables ();
|
||||
return grub_error (GRUB_ERR_BAD_OS, "couldn't read file %s", args[i]);
|
||||
if (!grub_errno)
|
||||
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
|
||||
args[i]);
|
||||
return grub_errno;
|
||||
}
|
||||
grub_file_close (file);
|
||||
|
||||
@ -675,8 +679,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
||||
if (! table)
|
||||
{
|
||||
free_tables ();
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
"couldn't allocate table structure");
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
table->size = size;
|
||||
@ -732,13 +735,20 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
||||
}
|
||||
acpi_tables = 0;
|
||||
|
||||
if (! state[9].set && (err = grub_acpi_create_ebda ()))
|
||||
#if defined (__i386__) || defined (__x86_64__)
|
||||
if (! state[9].set)
|
||||
{
|
||||
rsdpv1_new = 0;
|
||||
rsdpv2_new = 0;
|
||||
grub_mmap_free_and_unregister (mmapregion);
|
||||
return err;
|
||||
grub_err_t err;
|
||||
err = grub_acpi_create_ebda ();
|
||||
if (err)
|
||||
{
|
||||
rsdpv1_new = 0;
|
||||
rsdpv2_new = 0;
|
||||
grub_mmap_free_and_unregister (mmapregion);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
{
|
||||
@ -761,7 +771,7 @@ GRUB_MOD_INIT(acpi)
|
||||
{
|
||||
cmd = grub_register_extcmd ("acpi", grub_cmd_acpi, 0,
|
||||
N_("[-1|-2] [--exclude=TABLE1,TABLE2|"
|
||||
"--load-only=table1,table2] FILE1"
|
||||
"--load-only=TABLE1,TABLE2] FILE1"
|
||||
" [FILE2] [...]"),
|
||||
N_("Load host ACPI tables and tables "
|
||||
"specified by arguments."),
|
||||
|
@ -33,6 +33,12 @@ typedef uint8_t grub_uint8_t;
|
||||
#endif
|
||||
|
||||
#include <grub/acpi.h>
|
||||
#ifndef GRUB_DSDT_TEST
|
||||
#include <grub/i18n.h>
|
||||
#else
|
||||
#define _(x) x
|
||||
#define N_(x) x
|
||||
#endif
|
||||
|
||||
#ifndef GRUB_DSDT_TEST
|
||||
#include <grub/misc.h>
|
||||
@ -98,6 +104,7 @@ skip_data_ref_object (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
||||
switch (*ptr)
|
||||
{
|
||||
case GRUB_ACPI_OPCODE_PACKAGE:
|
||||
case GRUB_ACPI_OPCODE_BUFFER:
|
||||
return 1 + decode_length (ptr + 1, 0);
|
||||
case GRUB_ACPI_OPCODE_ZERO:
|
||||
case GRUB_ACPI_OPCODE_ONES:
|
||||
@ -109,6 +116,14 @@ skip_data_ref_object (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
||||
return 3;
|
||||
case GRUB_ACPI_OPCODE_DWORD_CONST:
|
||||
return 5;
|
||||
case GRUB_ACPI_OPCODE_STRING_CONST:
|
||||
{
|
||||
const grub_uint8_t *ptr0 = ptr;
|
||||
for (ptr++; ptr < end && *ptr; ptr++);
|
||||
if (ptr == end)
|
||||
return 0;
|
||||
return ptr - ptr0 + 1;
|
||||
}
|
||||
default:
|
||||
if (*ptr == '^' || *ptr == '\\' || *ptr == '_'
|
||||
|| (*ptr >= 'A' && *ptr <= 'Z'))
|
||||
@ -175,6 +190,16 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *end)
|
||||
if (!add)
|
||||
return -1;
|
||||
break;
|
||||
case GRUB_ACPI_OPCODE_CREATE_WORD_FIELD:
|
||||
case GRUB_ACPI_OPCODE_CREATE_BYTE_FIELD:
|
||||
{
|
||||
ptr += 5;
|
||||
ptr += add = skip_data_ref_object (ptr, end);
|
||||
if (!add)
|
||||
return -1;
|
||||
ptr += 4;
|
||||
break;
|
||||
}
|
||||
case GRUB_ACPI_OPCODE_NAME:
|
||||
ptr++;
|
||||
if (memcmp (ptr, "_S5_", 4) == 0 || memcmp (ptr, "\\_S5_", 4) == 0)
|
||||
@ -223,6 +248,9 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *end)
|
||||
ptr += decode_length (ptr, 0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
grub_printf ("Unknown opcode 0x%x\n", *ptr);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,6 +355,7 @@ grub_acpi_halt (void)
|
||||
|
||||
grub_millisleep (1500);
|
||||
|
||||
grub_printf ("ACPI shutdown failed\n");
|
||||
/* TRANSLATORS: It's computer shutdown using ACPI, not disabling ACPI. */
|
||||
grub_puts_ (N_("ACPI shutdown failed"));
|
||||
}
|
||||
#endif
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* pxe.c - command to control the pxe driver */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2011 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
|
||||
@ -18,37 +17,37 @@
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/machine/pxe.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/arc/arc.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_pxe_unload (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char **args __attribute__ ((unused)))
|
||||
grub_cmd_lsdev (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char **args __attribute__ ((unused)))
|
||||
{
|
||||
if (! grub_pxe_pxenv)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no pxe environment");
|
||||
|
||||
grub_pxe_unload ();
|
||||
|
||||
auto int hook (const char *name, const struct grub_arc_component *comp);
|
||||
int hook (const char *name, const struct grub_arc_component *comp __attribute__ ((unused)))
|
||||
{
|
||||
grub_printf ("%s\n", name);
|
||||
return 0;
|
||||
}
|
||||
grub_arc_iterate_devs (hook, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_command_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(pxecmd)
|
||||
GRUB_MOD_INIT(lsdev)
|
||||
{
|
||||
cmd = grub_register_command ("pxe_unload", grub_cmd_pxe_unload,
|
||||
0,
|
||||
N_("Unload PXE environment."));
|
||||
cmd = grub_register_command ("lsdev", grub_cmd_lsdev, "",
|
||||
N_("List devices."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(pxecmd)
|
||||
GRUB_MOD_FINI(lsdev)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user