From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OrgFv-0007zB-W2 for mharc-grub-devel@gnu.org; Fri, 03 Sep 2010 20:05:16 -0400 Received: from [140.186.70.92] (port=41071 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OrgFs-0007z4-MR for grub-devel@gnu.org; Fri, 03 Sep 2010 20:05:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OrgFr-0002vt-4H for grub-devel@gnu.org; Fri, 03 Sep 2010 20:05:12 -0400 Received: from mail-ew0-f41.google.com ([209.85.215.41]:65176) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OrgFq-0002vp-RQ for grub-devel@gnu.org; Fri, 03 Sep 2010 20:05:11 -0400 Received: by ewy28 with SMTP id 28so1805347ewy.0 for ; Fri, 03 Sep 2010 17:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:x-enigmail-version:content-type; bh=TM56Lxz0huze6h5Q7GMAD/f0/fWLFVHJhp77oBlKKsg=; b=cABLgoR5E4jEyaOzVdV6d7iDRNoSAKulpeeq5AAIxUcQyC2FW5QSBFZQb72CjY83RK WYUW/MNzGraHngk3GM0/L0x8tEt8YI8ixf7RB2FheQDGxp5sYIdotHVPjpS2ksTS//gx tM5EWx3SMe9ySESHzPGIuy1dkf0YTMRFlls2Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :x-enigmail-version:content-type; b=qvvx2lticI3cPmNkQOW8Ymqf8YshCvgrPDLVCgfg/NHWvinMmXbhLDgfj4i4sF60yi NrBZIk320ZoPi2rYdh8CTV4kdBLvg7NCJ+qJ/Xyd9NKU0WCJHIL81bnsxDlaVZvMZYfK h63Zb7StLO3BMFz+SXIs0h5NizCo32mhsUV0E= Received: by 10.213.63.142 with SMTP id b14mr321604ebi.33.1283558709890; Fri, 03 Sep 2010 17:05:09 -0700 (PDT) Received: from debian.bg45.phnet (100.71.63.81.cust.bluewin.ch [81.63.71.100]) by mx.google.com with ESMTPS id v8sm3674085eeh.2.2010.09.03.17.05.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 03 Sep 2010 17:05:08 -0700 (PDT) Message-ID: <4C818D2D.5060907@gmail.com> Date: Sat, 04 Sep 2010 02:05:01 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100805 Icedove/3.0.6 MIME-Version: 1.0 To: The development of GRUB 2 , "Turner, Ian" X-Enigmail-Version: 1.0.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enigB1FA1B8893B8AA706DEF5FE1" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Subject: [RFT] PXE chainloader X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Sep 2010 00:05:14 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigB1FA1B8893B8AA706DEF5FE1 Content-Type: multipart/mixed; boundary="------------090808090305040700090002" This is a multi-part message in MIME format. --------------090808090305040700090002 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------090808090305040700090002 Content-Type: text/x-diff; name="pxechain.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="pxechain.diff" =3D=3D=3D modified file 'grub-core/Makefile.core.def' --- grub-core/Makefile.core.def 2010-08-30 13:13:38 +0000 +++ grub-core/Makefile.core.def 2010-09-03 23:57:56 +0000 @@ -1064,6 +1064,12 @@ }; =20 module =3D { + name =3D pxechain; + i386_pc =3D loader/i386/pc/pxechainloader.c; + enable =3D i386_pc; +}; + +module =3D { name =3D multiboot2; cppflags =3D "-DGRUB_USE_MULTIBOOT2"; =20 =3D=3D=3D added file 'grub-core/loader/i386/pc/pxechainloader.c' --- grub-core/loader/i386/pc/pxechainloader.c 1970-01-01 00:00:00 +0000 +++ grub-core/loader/i386/pc/pxechainloader.c 2010-09-03 23:57:27 +0000 @@ -0,0 +1,130 @@ +/* chainloader.c - boot another boot loader */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2002,2004,2007,2009,2010 Free Software Foundation, In= c. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by= + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static grub_dl_t my_mod; +static struct grub_relocator *rel; +static grub_uint32_t edx =3D 0xffffffff; + +static grub_err_t +grub_pxechain_boot (void) +{ + struct grub_relocator16_state state =3D {=20 + .cs =3D 0, + .ip =3D 0x7c00, + .ds =3D 0, + .es =3D 0, + .fs =3D 0, + .gs =3D 0, + .ss =3D 0, + .sp =3D 0x7c00, + .edx =3D edx + }; + grub_video_set_mode ("text", 0, 0); + + return grub_relocator16_boot (rel, state); +} + +static grub_err_t +grub_pxechain_unload (void) +{ + grub_relocator_unload (rel); + rel =3D NULL; + grub_dl_unref (my_mod); + return GRUB_ERR_NONE; +} + +static grub_err_t +grub_cmd_pxechain (grub_command_t cmd __attribute__ ((unused)), + int argc, char *argv[]) +{ + grub_file_t file =3D 0; + grub_err_t err; + void *image; + grub_size_t imagesize; + + if (argc =3D=3D 0) + return grub_error (GRUB_ERR_BAD_ARGUMENT, "no file specified"); + + grub_dl_ref (my_mod); + + rel =3D grub_relocator_new (); + if (!rel) + goto fail; + + file =3D grub_file_open (argv[0]); + if (! file) + goto fail; + + + edx =3D grub_get_root_biosnumber (); + + imagesize =3D grub_file_size (file); + { + grub_relocator_chunk_t ch; + err =3D grub_relocator_alloc_chunk_addr (rel, &ch, 0x7c00, imagesize= ); + if (err) + goto fail; + image =3D get_virtual_current_address (ch); + } + + if (grub_file_read (file, image, imagesize) !=3D (grub_ssize_t) images= ize) + goto fail; +=20 + grub_loader_set (grub_pxechain_boot, grub_pxechain_unload, 1); + return GRUB_ERR_NONE; + + fail: + + if (file) + grub_file_close (file); + + grub_pxechain_unload (); + + return grub_errno; +} + +static grub_command_t cmd; + +GRUB_MOD_INIT(pxechainloader) +{ + cmd =3D grub_register_command ("pxechainloader", grub_cmd_pxechain, + 0, N_("Chainload a PXE image.")); + my_mod =3D mod; +} + +GRUB_MOD_FINI(pxechainloader) +{ + grub_unregister_command (cmd); +} --------------090808090305040700090002-- --------------enigB1FA1B8893B8AA706DEF5FE1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iF4EAREKAAYFAkyBjS0ACgkQNak7dOguQgnpswD8CW9YirJ3MU6mnhDlNrmuvUA4 svvC1rC3vILtmymA9EwA/15nCYUSQzR2mXZzAlDlf3+7uwkUlNxfx0pcfgsjxkzE =Gevd -----END PGP SIGNATURE----- --------------enigB1FA1B8893B8AA706DEF5FE1--