All of lore.kernel.org
 help / color / mirror / Atom feed
* GRUB2 / pxe
@ 2004-06-21  7:09 lode leroy
  2004-06-27 12:11 ` Marco Gerards
  0 siblings, 1 reply; 7+ messages in thread
From: lode leroy @ 2004-06-21  7:09 UTC (permalink / raw)
  To: grub-devel

Hello,

I managed to boot grub2 over PXE/TFTP/DHCP using the following code.
Could someone add this to grub2, please?
-- lode
ps: it's a mix between pxeloader.S from grub0.94, abd boot.S from grub2

====boot/i386/pc/pxeboot.S================================
#include <grub/boot.h>
#include <grub/machine/boot.h>

/*
*  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


===================================================
I created the image as follows (I'm sorry I have not managed to update the
makefiles appropriately)

gcc -Iboot/i386/pc -I../boot/i386/pc -I. -Iinclude -I../include -Wall -W
-DASM_FILE=1  -nostdinc -fno-builtin -c -o
pxeboot_img-boot_i386_pc_pxeboot.o ../boot/i386/pc/pxeboot.S
gcc -o pxeboot.exec pxeboot_img-boot_i386_pc_pxeboot.o  -nostdlib
-Wl,-N,-Ttext,8000
objcopy -O binary -R .note -R .comment pxeboot.exec pxeboot.img
make
./grub-mkimage -v -d . -o core.img _chain ext2 normal boot hello ls fat
_linux terminal vga font cat cmp minix ufs _multiboot
cat pxeboot.img core.img > pxegrub2
===================================================

_________________________________________________________________
MSN Messenger v6.2 al geïnstalleerd? 
http://messenger.msn.be?DI=1032&XAPID=2604&SU=hotmail.be




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GRUB2 / pxe
  2004-06-21  7:09 GRUB2 / pxe lode leroy
@ 2004-06-27 12:11 ` Marco Gerards
  2004-06-28  9:21   ` Yoshinori K. Okuji
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Gerards @ 2004-06-27 12:11 UTC (permalink / raw)
  To: The development of GRUB 2

"lode leroy" <lode_leroy@hotmail.com> 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  <metgerards@student.han.nl>

	* 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
	<lode_leroy@hotmail.com>.

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 <grub/boot.h>
+#include <grub/machine/boot.h>
+
+/*
+*  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)




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GRUB2 / pxe
@ 2004-06-28  9:10 lode leroy
  2004-06-28 16:38 ` Marco Gerards
  0 siblings, 1 reply; 7+ messages in thread
From: lode leroy @ 2004-06-28  9:10 UTC (permalink / raw)
  To: metgerards; +Cc: grub-devel


>>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?

yes, looks like it works!

>Is it ok for you this way?


This line in the makefile is too long (or was crippled in the mail archive)

$(CPPFLAGS) -DASM_FILE=1 $(ASFLAGS) $(pxeboot_img_ASFLAGS) -M $<          | 
sed
's,pxeboot\.o[ :]*,pxeboot_img-boot_i386_pc_pxeboot.o $@ : ,g' > $@;      [ 
-s
$@ ] || rm -f $@

>>-- 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?
>

I think there should not be copyright issues: there's only 1 line of code,
and Okuji wrote it :-)

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GRUB2 / pxe
  2004-06-27 12:11 ` Marco Gerards
@ 2004-06-28  9:21   ` Yoshinori K. Okuji
  2004-06-28 16:22     ` Marco Gerards
  0 siblings, 1 reply; 7+ messages in thread
From: Yoshinori K. Okuji @ 2004-06-28  9:21 UTC (permalink / raw)
  To: The development of GRUB 2

On Sunday 27 June 2004 14:11, Marco Gerards wrote:
> Okuji, can I commit this patch when it works for Lode?  Are there
> copyright issues?

It's just a copy of GRUB Legacy, so there is no problem about the 
copyright. But I'm not sure how useful it is, since network support is 
not implemented at all.

Okuji



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GRUB2 / pxe
  2004-06-28  9:21   ` Yoshinori K. Okuji
@ 2004-06-28 16:22     ` Marco Gerards
  2004-07-11 14:39       ` Marco Gerards
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Gerards @ 2004-06-28 16:22 UTC (permalink / raw)
  To: The development of GRUB 2

"Yoshinori K. Okuji" <okuji@enbug.org> writes:

> On Sunday 27 June 2004 14:11, Marco Gerards wrote:
>> Okuji, can I commit this patch when it works for Lode?  Are there
>> copyright issues?
>
> It's just a copy of GRUB Legacy, so there is no problem about the 
> copyright. But I'm not sure how useful it is, since network support is 
> not implemented at all.

That is no problem.  Using this patch I can load GRUB on my second box
by using the network, instead of a floppy.  This will make testing
easier.

I will commit this patch tonight or tomorrow.

Thanks,
Marco




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GRUB2 / pxe
  2004-06-28  9:10 lode leroy
@ 2004-06-28 16:38 ` Marco Gerards
  0 siblings, 0 replies; 7+ messages in thread
From: Marco Gerards @ 2004-06-28 16:38 UTC (permalink / raw)
  To: lode leroy; +Cc: grub-devel

"lode leroy" <lode_leroy@hotmail.com> writes:

>>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?
>
> yes, looks like it works!

Great!

>>Is it ok for you this way?
>
> This line in the makefile is too long (or was crippled in the mail archive)

That is not a problem.  It is a generated file, I just included it for
your convenience.

> I think there should not be copyright issues: there's only 1 line of code,
> and Okuji wrote it :-)

Ok, in that case there is no problem and I will apply the patch soon.

Thanks,
Marco




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GRUB2 / pxe
  2004-06-28 16:22     ` Marco Gerards
@ 2004-07-11 14:39       ` Marco Gerards
  0 siblings, 0 replies; 7+ messages in thread
From: Marco Gerards @ 2004-07-11 14:39 UTC (permalink / raw)
  To: The development of GRUB 2

Marco Gerards <metgerards@student.han.nl> writes:

> I will commit this patch tonight or tomorrow.

I just committed the patch.  I'm sorry for the delay.

--
Marco




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-07-11 14:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-21  7:09 GRUB2 / pxe lode leroy
2004-06-27 12:11 ` Marco Gerards
2004-06-28  9:21   ` Yoshinori K. Okuji
2004-06-28 16:22     ` Marco Gerards
2004-07-11 14:39       ` Marco Gerards
  -- strict thread matches above, loose matches on Subject: below --
2004-06-28  9:10 lode leroy
2004-06-28 16:38 ` Marco Gerards

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.