From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.33) id 1BeYbs-0001en-UK for mharc-grub-devel@gnu.org; Sun, 27 Jun 2004 08:18:13 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BeYbr-0001ei-Oq for grub-devel@gnu.org; Sun, 27 Jun 2004 08:18:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BeYbr-0001eW-6X for grub-devel@gnu.org; Sun, 27 Jun 2004 08:18:11 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BeYbr-0001eT-4R for grub-devel@gnu.org; Sun, 27 Jun 2004 08:18:11 -0400 Received: from [145.74.66.11] (helo=mail-cn.han.nl) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BeYZy-0004dK-Ns for grub-devel@gnu.org; Sun, 27 Jun 2004 08:16:15 -0400 Received: from localhost (charlie.han.nl [145.74.66.9]) by mail-cn.han.nl (Postfix) with ESMTP id E5F4B88F5 for ; Sun, 27 Jun 2004 14:11:33 +0200 (CEST) Received: from mail-cn.han.nl ([145.74.66.11]) by localhost (charlie.han.nl [145.74.66.9]) (amavisd-new, port 10024) with ESMTP id 13067-07 for ; Sun, 27 Jun 2004 14:11:31 +0200 (CEST) Received: from mail1.han.nl (mail1.han.nl [145.74.103.11]) by mail-cn.han.nl (Postfix) with ESMTP id 78A3488F3 for ; Sun, 27 Jun 2004 14:11:31 +0200 (CEST) Received: from marco.marco-g.com (a82-92-27-129.adsl.xs4all.nl [82.92.27.129]) by mail1.han.nl (Postfix) with ESMTP id 97CE2C045 for ; Sun, 27 Jun 2004 13:11:30 +0200 (CEST) Mail-Copies-To: metgerards@student.han.nl To: The development of GRUB 2 References: From: Marco Gerards Date: Sun, 27 Jun 2004 14:11:36 +0200 In-Reply-To: (lode leroy's message of "Mon, 21 Jun 2004 09:09:04 +0200") Message-ID: <877jtt42vb.fsf@marco.marco-g.com> User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new@vscan-cn.han.nl Subject: Re: GRUB2 / pxe X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jun 2004 12:18:11 -0000 "lode leroy" writes: > I managed to boot grub2 over PXE/TFTP/DHCP using the following code. > Could someone add this to grub2, please? This would be quite useful to me for testing, great! Using your code I made the patch I included at the end of the email. I've also regenerated the `conf/i386-pc.mk' file, in case you don't have ruby installed. Can you please test this patch? Is it ok for you this way? > -- lode > ps: it's a mix between pxeloader.S from grub0.94, abd boot.S from grub2 Okuji, can I commit this patch when it works for Lode? Are there copyright issues? Thanks, Marco 2004-05-24 Marco Gerards * conf/i386-pc.rmk (pkgdata_IMAGE): Add pxeboot.img. (pxeboot_img_SOURCES): New variable. (pxeboot_img_ASFLAGS): Likewise. (pxeboot_img_LDFLAGS): Likewise. * boot/i386/pc/pxeboot.S: New file. Based on pxeloader.S from GRUB Legacy and boot.S. Adopted for GRUB 2 by lode leroy . Index: boot/i386/pc/pxeboot.S =================================================================== RCS file: boot/i386/pc/pxeboot.S diff -N boot/i386/pc/pxeboot.S --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ boot/i386/pc/pxeboot.S 27 Jun 2004 12:07:46 -0000 @@ -0,0 +1,43 @@ +/* -*-Asm-*- */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 1999,2000,2001,2002,2004 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +/* +* defines for the code go here +*/ + + .file "pxeboot.S" + + .text + + /* Tell GAS to generate 16-bit instructions so that this code works + in real mode. */ + .code16 + +.globl _start; _start: + /* + * _start is loaded at 0x7c00 and is jumped to with CS:IP 0:0x7c00 + */ + ljmp $0, $0x8200 + + . = 0x8000 - 0x7C00 -1 + .byte 0 Index: conf/i386-pc.mk =================================================================== RCS file: /cvsroot/grub/grub2/conf/i386-pc.mk,v retrieving revision 1.14 diff -u -p -u -p -r1.14 i386-pc.mk --- conf/i386-pc.mk 24 May 2004 21:32:20 -0000 1.14 +++ conf/i386-pc.mk 27 Jun 2004 12:07:47 -0000 @@ -4,7 +4,7 @@ COMMON_ASFLAGS = -nostdinc -fno-builtin COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 # Images. -pkgdata_IMAGES = boot.img diskboot.img kernel.img +pkgdata_IMAGES = boot.img diskboot.img kernel.img pxeboot.img # For boot.img. boot_img_SOURCES = boot/i386/pc/boot.S @@ -28,6 +28,28 @@ boot_img-boot_i386_pc_boot.d: boot/i386/ boot_img_ASFLAGS = $(COMMON_ASFLAGS) boot_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00 +# For pxeboot.img +pxeboot_img_SOURCES = boot/i386/pc/pxeboot.S +CLEANFILES += pxeboot.img pxeboot.exec pxeboot_img-boot_i386_pc_pxeboot.o +MOSTLYCLEANFILES += pxeboot_img-boot_i386_pc_pxeboot.d + +pxeboot.img: pxeboot.exec + $(OBJCOPY) -O binary -R .note -R .comment $< $@ + +pxeboot.exec: pxeboot_img-boot_i386_pc_pxeboot.o + $(CC) -o $@ $^ $(LDFLAGS) $(pxeboot_img_LDFLAGS) + +pxeboot_img-boot_i386_pc_pxeboot.o: boot/i386/pc/pxeboot.S + $(CC) -Iboot/i386/pc -I$(srcdir)/boot/i386/pc $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(pxeboot_img_ASFLAGS) -c -o $@ $< + +pxeboot_img-boot_i386_pc_pxeboot.d: boot/i386/pc/pxeboot.S + set -e; $(CC) -Iboot/i386/pc -I$(srcdir)/boot/i386/pc $(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(pxeboot_img_ASFLAGS) -M $< | sed 's,pxeboot\.o[ :]*,pxeboot_img-boot_i386_pc_pxeboot.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ + +-include pxeboot_img-boot_i386_pc_pxeboot.d + +pxeboot_img_ASFLAGS = $(COMMON_ASFLAGS) +pxeboot_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,8000 + # For diskboot.img. diskboot_img_SOURCES = boot/i386/pc/diskboot.S CLEANFILES += diskboot.img diskboot.exec diskboot_img-boot_i386_pc_diskboot.o Index: conf/i386-pc.rmk =================================================================== RCS file: /cvsroot/grub/grub2/conf/i386-pc.rmk,v retrieving revision 1.14 diff -u -p -u -p -r1.14 i386-pc.rmk --- conf/i386-pc.rmk 24 May 2004 21:32:21 -0000 1.14 +++ conf/i386-pc.rmk 27 Jun 2004 12:07:47 -0000 @@ -4,13 +4,18 @@ COMMON_ASFLAGS = -nostdinc -fno-builtin COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 # Images. -pkgdata_IMAGES = boot.img diskboot.img kernel.img +pkgdata_IMAGES = boot.img diskboot.img kernel.img pxeboot.img # For boot.img. boot_img_SOURCES = boot/i386/pc/boot.S boot_img_ASFLAGS = $(COMMON_ASFLAGS) boot_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00 +# For pxeboot.img +pxeboot_img_SOURCES = boot/i386/pc/pxeboot.S +pxeboot_img_ASFLAGS = $(COMMON_ASFLAGS) +pxeboot_img_LDFLAGS = -nostdlib -Wl,-N,-Ttext,8000 + # For diskboot.img. diskboot_img_SOURCES = boot/i386/pc/diskboot.S diskboot_img_ASFLAGS = $(COMMON_ASFLAGS)