From: Robert Millan Date: Fri, 25 Dec 2009 22:29:47 +0000 (+0000) Subject: Merge from trunk X-Git-Tag: 1.98~160^2~13 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=d94000ed131d752c5adf34b2a214d69a9b6eda29;p=thirdparty%2Fgrub.git Merge from trunk --- d94000ed131d752c5adf34b2a214d69a9b6eda29 diff --cc include/grub/at_keyboard.h index ba8071f20,000000000..10421540a mode 100644,000000..100644 --- a/include/grub/at_keyboard.h +++ b/include/grub/at_keyboard.h @@@ -1,52 -1,0 +1,54 @@@ +/* + * GRUB -- GRand Unified Bootloader - * Copyright (C) 2007,2008 Free Software Foundation, Inc. ++ * Copyright (C) 2007,2008,2009 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 . + */ + +#ifndef GRUB_AT_KEYBOARD_HEADER +#define GRUB_AT_KEYBOARD_HEADER 1 + +#define SHIFT_L 0x2a +#define SHIFT_R 0x36 +#define CTRL 0x1d +#define ALT 0x38 +#define CAPS_LOCK 0x3a ++#define NUM_LOCK 0x45 ++#define SCROLL_LOCK 0x46 + +/* Used for sending commands to the controller. */ +#define KEYBOARD_COMMAND_ISREADY(x) !((x) & 0x02) +#define KEYBOARD_COMMAND_READ 0x20 +#define KEYBOARD_COMMAND_WRITE 0x60 +#define KEYBOARD_COMMAND_REBOOT 0xfe + +#define KEYBOARD_SCANCODE_SET1 0x40 + +#define KEYBOARD_ISMAKE(x) !((x) & 0x80) +#define KEYBOARD_ISREADY(x) ((x) & 0x01) +#define KEYBOARD_SCANCODE(x) ((x) & 0x7f) + +#ifdef GRUB_MACHINE_IEEE1275 +#define OLPC_UP GRUB_TERM_UP +#define OLPC_DOWN GRUB_TERM_DOWN +#define OLPC_LEFT GRUB_TERM_LEFT +#define OLPC_RIGHT GRUB_TERM_RIGHT +#else +#define OLPC_UP '\0' +#define OLPC_DOWN '\0' +#define OLPC_LEFT '\0' +#define OLPC_RIGHT '\0' +#endif + +#endif diff --cc kern/elf.c index 1e51839a0,10fe9c758..0c5b4a3b4 --- a/kern/elf.c +++ b/kern/elf.c @@@ -196,12 -198,9 +198,12 @@@ grub_elf32_size (grub_elf_t elf, Elf32_ grub_elf32_phdr_iterate (elf, calcsize, 0); + if (base) + *base = 0; + if (nr_phdrs == 0) { - grub_error (GRUB_ERR_BAD_OS, "No program headers present"); + grub_error (GRUB_ERR_BAD_OS, "no program headers present"); return 0; } @@@ -380,12 -379,9 +384,12 @@@ grub_elf64_size (grub_elf_t elf, Elf64_ grub_elf64_phdr_iterate (elf, calcsize, 0); + if (base) + *base = 0; + if (nr_phdrs == 0) { - grub_error (GRUB_ERR_BAD_OS, "No program headers present"); + grub_error (GRUB_ERR_BAD_OS, "no program headers present"); return 0; } diff --cc po/POTFILES index 28623a096,6efa12219..b36f7bbf2 --- a/po/POTFILES +++ b/po/POTFILES @@@ -1,5 -1,14 +1,14 @@@ # List of files which contain translatable strings. + commands/i386/pc/play.c + commands/loadenv.c + commands/search.c + commands/help.c + + lib/arg.c + + normal/dyncmd.c + -util/i386/pc/grub-mkimage.c +util/grub-mkrawimage.c util/i386/pc/grub-setup.c util/mkisofs/eltorito.c diff --cc util/grub-install.in index 494ac6bc3,7283e1b40..bc7035a2d --- a/util/grub-install.in +++ b/util/grub-install.in @@@ -29,7 -29,7 +29,8 @@@ PACKAGE_TARNAME=@PACKAGE_TARNAME PACKAGE_VERSION=@PACKAGE_VERSION@ target_cpu=@target_cpu@ platform=@platform@ + host_os=@host_os@ +font=@datadir@/@PACKAGE_TARNAME@/ascii.pf2 pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}` grub_setup=${sbindir}/`echo grub-setup | sed ${transform}` diff --cc util/grub-mkrawimage.c index 58b30f5be,3c2cb7549..8186c8601 --- a/util/grub-mkrawimage.c +++ b/util/grub-mkrawimage.c @@@ -236,19 -204,19 +236,19 @@@ generate_image (const char *dir, char * num = ((core_size + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS); if (num > 0xffff) grub_util_error (_("the core image is too big")); - - ++ boot_path = grub_util_get_path (dir, "diskboot.img"); boot_size = grub_util_get_image_size (boot_path); if (boot_size != GRUB_DISK_SECTOR_SIZE) - grub_util_error (_("diskboot.img size must be %u bytes"), GRUB_DISK_SECTOR_SIZE); - + grub_util_error (_("diskboot.img size must be %u bytes"), + GRUB_DISK_SECTOR_SIZE); - ++ boot_img = grub_util_read_image (boot_path); - - - /* i386 is a little endian architecture. */ ++ *((grub_uint16_t *) (boot_img + GRUB_DISK_SECTOR_SIZE - GRUB_BOOT_MACHINE_LIST_SIZE + 8)) - = grub_cpu_to_le16 (num); - + = grub_host_to_target16 (num); - ++ grub_util_write_image (boot_img, boot_size, out); free (boot_img); free (boot_path); @@@ -315,70 -282,7 +315,70 @@@ #ifdef GRUB_MACHINE_PCBIOS if (GRUB_KERNEL_MACHINE_LINK_ADDR + core_size > GRUB_MEMORY_MACHINE_UPPER) grub_util_error (_("Core image is too big (%p > %p)\n"), - GRUB_KERNEL_MACHINE_LINK_ADDR + core_size, GRUB_MEMORY_MACHINE_UPPER); + GRUB_KERNEL_MACHINE_LINK_ADDR + core_size, + GRUB_MEMORY_MACHINE_UPPER); +#endif + +#if defined(GRUB_MACHINE_MIPS) + if (format == GRUB_PLATFORM_IMAGE_ELF) + { + char *elf_img; + size_t program_size; + Elf32_Ehdr *ehdr; + Elf32_Phdr *phdr; + grub_uint32_t target_addr; + + program_size = ALIGN_UP (core_size, 4); + + elf_img = xmalloc (program_size + sizeof (*ehdr) + sizeof (*phdr)); + memset (elf_img, 0, program_size + sizeof (*ehdr) + sizeof (*phdr)); + memcpy (elf_img + sizeof (*ehdr) + sizeof (*phdr), core_img, core_size); + ehdr = (void *) elf_img; + phdr = (void *) (elf_img + sizeof (*ehdr)); + memcpy (ehdr->e_ident, ELFMAG, SELFMAG); + ehdr->e_ident[EI_CLASS] = ELFCLASS32; +#ifdef GRUB_CPU_MIPSEL + ehdr->e_ident[EI_DATA] = ELFDATA2LSB; +#else + ehdr->e_ident[EI_DATA] = ELFDATA2MSB; +#endif + ehdr->e_ident[EI_VERSION] = EV_CURRENT; + ehdr->e_ident[EI_OSABI] = ELFOSABI_NONE; + ehdr->e_type = grub_host_to_target16 (ET_EXEC); + ehdr->e_machine = grub_host_to_target16 (EM_MIPS); + ehdr->e_version = grub_host_to_target32 (EV_CURRENT); + + ehdr->e_phoff = grub_host_to_target32 ((char *) phdr - (char *) ehdr); + ehdr->e_phentsize = grub_host_to_target16 (sizeof (*phdr)); + ehdr->e_phnum = grub_host_to_target16 (1); + + /* No section headers. */ + ehdr->e_shoff = grub_host_to_target32 (0); + ehdr->e_shentsize = grub_host_to_target16 (0); + ehdr->e_shnum = grub_host_to_target16 (0); + ehdr->e_shstrndx = grub_host_to_target16 (0); - ++ + ehdr->e_ehsize = grub_host_to_target16 (sizeof (*ehdr)); - ++ + phdr->p_type = grub_host_to_target32 (PT_LOAD); + phdr->p_offset = grub_host_to_target32 (sizeof (*ehdr) + sizeof (*phdr)); + phdr->p_flags = grub_host_to_target32 (PF_R | PF_W | PF_X); - ++ + target_addr = ALIGN_UP (GRUB_KERNEL_MACHINE_LINK_ADDR + + kernel_size + total_module_size, 32); + ehdr->e_entry = grub_host_to_target32 (target_addr); + phdr->p_vaddr = grub_host_to_target32 (target_addr); + phdr->p_paddr = grub_host_to_target32 (target_addr); + phdr->p_align = grub_host_to_target32 (GRUB_KERNEL_MACHINE_LINK_ALIGN); + ehdr->e_flags = grub_host_to_target32 (0x1000 | EF_MIPS_NOREORDER + | EF_MIPS_PIC | EF_MIPS_CPIC); + phdr->p_filesz = grub_host_to_target32 (core_size); + phdr->p_memsz = grub_host_to_target32 (core_size); + + free (core_img); + core_img = elf_img; + core_size = program_size + sizeof (*ehdr) + sizeof (*phdr); + } #endif grub_util_write_image (core_img, core_size, out);