From: Vladimir 'phcoder' Serbinenko Date: Wed, 22 Sep 2010 18:13:00 +0000 (+0200) Subject: Merge mainline into net X-Git-Tag: 2.00~1195^2~29 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=760a7e5aed711c59e6d124dc3a8a7ce03d87865b;p=thirdparty%2Fgrub.git Merge mainline into net --- 760a7e5aed711c59e6d124dc3a8a7ce03d87865b diff --cc Makefile.util.def index 68c105a9b,f4ae01bd3..1a5944da2 --- a/Makefile.util.def +++ b/Makefile.util.def @@@ -30,9 -21,7 +21,8 @@@ library = common = grub-core/commands/blocklist.c; common = grub-core/commands/extcmd.c; common = grub-core/commands/ls.c; + common = grub-core/net/net.c; common = grub-core/disk/dmraid_nvidia.c; - common = grub-core/disk/host.c; common = grub-core/disk/loopback.c; common = grub-core/disk/lvm.c; common = grub-core/disk/mdraid_linux.c; diff --cc grub-core/Makefile.am index 1fcc3d00d,addc83417..89cab1ee4 --- a/grub-core/Makefile.am +++ b/grub-core/Makefile.am @@@ -74,10 -74,10 +74,11 @@@ KERNEL_HEADER_FILES += $(top_srcdir)/in 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/memory.h 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 diff --cc grub-core/Makefile.core.def index 2f55ba5ec,bf79a277a..d48c5d505 --- a/grub-core/Makefile.core.def +++ b/grub-core/Makefile.core.def @@@ -1377,30 -1431,42 +1431,70 @@@ module = common = hook/datehook.c; }; +module = { + name = net; + common = net/net.c; + common = net/ip.c; + common = net/udp.c; + common = net/ethernet.c; + common = net/arp.c; + common = net/interface.c; + common = net/netbuff.c; +}; + +module = { + name = tftp; + common = net/tftp.c; +}; + +module = { + name = ofnet; + ieee1275 = net/drivers/ieee1275/ofnet.c; + enable = ieee1275; +}; + +module = { + name = emunet; + emu = net/drivers/emu/emunet.c; + enable = ieee1275; +}; ++ + module = { + name = legacycfg; + common = commands/legacycfg.c; + common = lib/legacy_parse.c; + emu = lib/i386/pc/vesa_modes_table.c; + enable = i386_pc; + enable = emu; + }; + + module = { + name = test_blockarg; + common = tests/test_blockarg.c; + }; + + module = { + name = xzio; + common = io/xzio.c; + common = lib/xzembed/xz_dec_bcj.c; + common = lib/xzembed/xz_dec_lzma2.c; + common = lib/xzembed/xz_dec_stream.c; + cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed'; + }; + + module = { + name = testload; + common = commands/testload.c; + }; + + module = { + name = lsapm; + common = commands/i386/pc/lsapm.c; + enable = i386_pc; + }; + + module = { + name = keylayouts; + common = commands/keylayouts.c; + enable = videomodules; + }; diff --cc grub-core/kern/ieee1275/openfw.c index 6670804b7,f5dc8efb1..3c228f574 --- a/grub-core/kern/ieee1275/openfw.c +++ b/grub-core/kern/ieee1275/openfw.c @@@ -438,3 -424,46 +438,47 @@@ grub_reboot (void } #endif + /* Resolve aliases. */ + char * + grub_ieee1275_canonicalise_devname (const char *path) + { + struct canon_args + { + struct grub_ieee1275_common_hdr common; + grub_ieee1275_cell_t path; + grub_ieee1275_cell_t buf; + grub_ieee1275_cell_t inlen; + grub_ieee1275_cell_t outlen; + } + args; + char *buf = NULL; + grub_size_t bufsize = 64; + int i; + + for (i = 0; i < 2; i++) + { + grub_free (buf); + + buf = grub_malloc (bufsize); + if (!buf) + return NULL; + + INIT_IEEE1275_COMMON (&args.common, "canon", 3, 1); + args.path = (grub_ieee1275_cell_t) path; + args.buf = (grub_ieee1275_cell_t) buf; + args.inlen = (grub_ieee1275_cell_t) (bufsize - 1); + + if (IEEE1275_CALL_ENTRY_FN (&args) == -1) + return 0; + if (args.outlen > bufsize - 1) + { + bufsize = args.outlen + 2; + continue; + } + return buf; + } + /* Shouldn't reach here. */ + grub_free (buf); + return NULL; + } ++ diff --cc grub-core/loader/i386/multiboot_mbi.c index 9d6497442,283b84c5a..af09e9d73 --- a/grub-core/loader/i386/multiboot_mbi.c +++ b/grub-core/loader/i386/multiboot_mbi.c @@@ -198,16 -195,12 +199,21 @@@ grub_multiboot_get_mbi_size (void + ALIGN_UP (sizeof(PACKAGE_STRING), 4) + grub_get_multiboot_mmap_count () * sizeof (struct multiboot_mmap_entry) + elf_sec_entsize * elf_sec_num - + 256 * sizeof (struct multiboot_color); + + 256 * sizeof (struct multiboot_color) + #if GRUB_MACHINE_HAS_VBE + + sizeof (struct grub_vbe_info_block) + + sizeof (struct grub_vbe_mode_info_block) + #endif + + ALIGN_UP (sizeof (struct multiboot_apm_info), 4); + + FOR_NET_NETWORK_LEVEL_INTERFACES(net) + if (net->dhcp_ack) + { + ret += net->dhcp_acklen; + break; + } + + return ret; } /* Fill previously allocated Multiboot mmap. */ diff --cc grub-core/net/i386/pc/pxe.c index 347d8562b,cbb3c7d87..fd1447b40 --- a/grub-core/net/i386/pc/pxe.c +++ b/grub-core/net/i386/pc/pxe.c @@@ -225,11 -323,11 +226,11 @@@ grub_pxefs_read (grub_file_t file, cha if (curr_file != 0) grub_pxe_call (GRUB_PXENV_TFTP_CLOSE, &o, pxe_rm_entry); - o.server_ip = disk_data->server_ip; - o.gateway_ip = disk_data->gateway_ip; + o.server_ip = data->server_ip; + o.gateway_ip = data->gateway_ip; grub_strcpy ((char *)&o.filename[0], data->filename); o.tftp_port = grub_cpu_to_be16 (GRUB_PXE_TFTP_PORT); - o.packet_size = grub_pxe_blksize; + o.packet_size = data->block_size; grub_pxe_call (GRUB_PXENV_TFTP_OPEN, &o, pxe_rm_entry); if (o.status) { diff --cc include/grub/err.h index 8b2ba4dde,22334038d..211fafa70 --- a/include/grub/err.h +++ b/include/grub/err.h @@@ -55,10 -55,7 +55,11 @@@ typedef enu GRUB_ERR_TIMEOUT, GRUB_ERR_IO, GRUB_ERR_ACCESS_DENIED, - GRUB_ERR_EXTRACTOR ++ GRUB_ERR_EXTRACTOR, + GRUB_ERR_NET_BAD_ADDRESS, + GRUB_ERR_NET_ROUTE_LOOP, + GRUB_ERR_NET_NO_ROUTE, + GRUB_ERR_WAIT } grub_err_t; diff --cc include/grub/ieee1275/ieee1275.h index 8fb558fa7,2592dd348..3edcfa8f6 --- a/include/grub/ieee1275/ieee1275.h +++ b/include/grub/ieee1275/ieee1275.h @@@ -191,7 -188,8 +194,9 @@@ char *EXPORT_FUNC(grub_ieee1275_get_fil int EXPORT_FUNC(grub_ieee1275_devices_iterate) (int (*hook) (struct grub_ieee1275_devalias * alias)); - +char *EXPORT_FUNC(grub_ieee1275_get_aliasdevname) (const char *path); +void EXPORT_FUNC(grub_ofnet_findcards) (void); +void EXPORT_FUNC(grub_ofnet_probecards) (void); + char *EXPORT_FUNC(grub_ieee1275_canonicalise_devname) (const char *path); + #endif /* ! GRUB_IEEE1275_HEADER */