Skip to contentSkip to conversation

getting etherboot compiling

DISCUSSION John Levon 4 participants 11 messages Feb 1, 2008 – Feb 5, 2008

lore
Share & tools
lore

John Levon

author
#0 lore raw

It's riddled with Linux-isms. I have no idea what this code is really for, or how to test it, so I'm not going to be much use fixing this up.

With the patch below (at least some of the way), I just get:

gld -melf_i386 -N -T arch/i386/core/etherboot.lds -o bin/eepro100.rom.rt bin/pciprefix.exit.o bin/eepro100.rt.o eepro100.rom.rt: Bad entry point
/bin/sh: test: argument expected

Suggestions?

regards
john

author
#1 lore raw
Quoted 1 line · John Levon

With the patch below (at least some of the way), I just get:

And the patch

john

config/StdGNU.mk +1 -0
@@ -12,6 +12,7 @@ SIZEUTIL   = $(CROSS_COMPILE)size
 
 MSGFMT     = msgfmt
 MSGMERGE   = msgmerge
+TAR        = tar
 
 INSTALL      = install
 INSTALL_DIR  = $(INSTALL) -d -m0755 -p
config/SunOS.mk +1 -0
@@ -11,6 +11,7 @@ SIZEUTIL   = $(CROSS_COMPILE)gsize
 SIZEUTIL   = $(CROSS_COMPILE)gsize
 
 MSGFMT     = gmsgfmt
+TAR        = gtar
 
 SHELL      = bash
 
tools/firmware/etherboot/Makefile +5 -5
@@ -21,14 +21,14 @@ eb-%.zrom.h: $E/src/Config
 	mv -f [email protected] $@
 
 eb-rom-list.h: make-eb-rom-list $E/src/bin/Roms
-	./$^ $(NICS) >[email protected] && mv -f [email protected] $@
+	PATH=/usr/gnu/bin/:$(PATH) ./$^ $(NICS) >[email protected] && mv -f [email protected] $@
 
 eb-roms.h: eb-rom-list.h $(ROM_ZHS)
 	cat $^ >[email protected] && mv -f [email protected] $@
 
 $E/src/Config: $T Config
 	rm -rf $D $E
-	tar zxf $T
+	$(TAR) zxf $T
 	cat Config >>$D/src/Config
 	@
 	# override many of the settings in Config
@@ -36,14 +36,14 @@ eb-roms.h: eb-rom-list.h $(ROM_ZHS)
 	echo "HOST_CC=$(HOSTCC)" >>$D/src/Config
 	echo "CPP=$(CPP)" >>$D/src/Config
 	echo "CC=$(CC)" >>$D/src/Config
-	echo "AS=$(CC) -c -x assembler -" >>$D/src/Config
+	echo "AS=$(AS)" >>$D/src/Config
 	echo "LD=$(LD)" >>$D/src/Config
 	echo "SIZE=$(SIZE)" >>$D/src/Config
 	echo "AR=$(AR)" >>$D/src/Config
 	echo "RANLIB=$(RANLIB)" >>$D/src/Config
 	echo "OBJCOPY=$(OBJCOPY)" >>$D/src/Config
 	echo "CFLAGS+=$(CFLAGS)" >>$D/src/Config
-	echo "ASFLAGS+=$(CFLAGS)" >>$D/src/Config
+	echo "ASFLAGS+=$(ASFLAGS)" >>$D/src/Config
 	echo "LDFLAGS+=$(LDFLAGS_DIRECT)" >>$D/src/Config
 	@
 	set -e; cd $D/src/arch/i386; \
@@ -53,7 +53,7 @@ eb-roms.h: eb-rom-list.h $(ROM_ZHS)
 	mv $D $E
 
 $E/src/bin/Roms: $E/src/Config
-	$(MAKE) -C $E/src bin/Roms
+	PATH=/usr/gnu/bin/:$(PATH) $(MAKE) -C $E/src bin/Roms
 
 clean:
 	rm -rf $D $E *.zrom.h eb-rom-list.h eb-roms.h *~
tools/firmware/etherboot/make-eb-rom-list +1 -1
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 set -e
 roms=$1; shift
 echo "/* autogenerated - do not edit */"
#2 lore raw

Probably should take this patch and then either build no ROMs if not building on Linux, or have a default pre-prepared set of ROMs checked into the repo.

-- Keir

Quoted 92 lines · John Levon
Quoted 1 line · John Levon

With the patch below (at least some of the way), I just get:

And the patch

john

config/StdGNU.mk +1 -0
@@ -12,6 +12,7 @@ SIZEUTIL   = $(CROSS_COMPILE)size
 
 MSGFMT     = msgfmt
 MSGMERGE   = msgmerge
+TAR        = tar
 
 INSTALL      = install
 INSTALL_DIR  = $(INSTALL) -d -m0755 -p
config/SunOS.mk +1 -0
@@ -11,6 +11,7 @@ SIZEUTIL   = $(CROSS_COMPILE)gsize
 SIZEUTIL   = $(CROSS_COMPILE)gsize
 
 MSGFMT     = gmsgfmt
+TAR        = gtar
 
 SHELL      = bash
 
tools/firmware/etherboot/Makefile +0 -0
@@ -21,14 +21,14 @@ eb-%.zrom.h: $E/src/Config

mv -f [email protected] $@

eb-rom-list.h: make-eb-rom-list $E/src/bin/Roms
- ./$^ $(NICS) >[email protected] && mv -f [email protected] $@
+ PATH=/usr/gnu/bin/:$(PATH) ./$^ $(NICS) >[email protected] && mv -f [email protected] $@

eb-roms.h: eb-rom-list.h $(ROM_ZHS)
cat $^ >[email protected] && mv -f [email protected] $@

$E/src/Config: $T Config
rm -rf $D $E
- tar zxf $T
+ $(TAR) zxf $T
cat Config >>$D/src/Config
@

# override many of the settings in Config
tools/firmware/etherboot/Makefile +0 -0
@@ -36,14 +36,14 @@ eb-roms.h: eb-rom-list.h $(ROM_ZHS)

echo "HOST_CC=$(HOSTCC)" >>$D/src/Config echo "CPP=$(CPP)" >>$D/src/Config
echo "CC=$(CC)" >>$D/src/Config
- echo "AS=$(CC) -c -x assembler -" >>$D/src/Config
+ echo "AS=$(AS)" >>$D/src/Config
echo "LD=$(LD)" >>$D/src/Config
echo "SIZE=$(SIZE)" >>$D/src/Config
echo "AR=$(AR)" >>$D/src/Config
echo "RANLIB=$(RANLIB)" >>$D/src/Config echo "OBJCOPY=$(OBJCOPY)" >>$D/src/Config echo "CFLAGS+=$(CFLAGS)" >>$D/src/Config
- echo "ASFLAGS+=$(CFLAGS)" >>$D/src/Config
+ echo "ASFLAGS+=$(ASFLAGS)" >>$D/src/Config echo "LDFLAGS+=$(LDFLAGS_DIRECT)" >>$D/src/Config @
set -e; cd $D/src/arch/i386; \

tools/firmware/etherboot/Makefile +0 -0
@@ -53,7 +53,7 @@ eb-roms.h: eb-rom-list.h $(ROM_ZHS)

mv $D $E

$E/src/bin/Roms: $E/src/Config
- $(MAKE) -C $E/src bin/Roms
+ PATH=/usr/gnu/bin/:$(PATH) $(MAKE) -C $E/src bin/Roms

clean:
rm -rf $D $E *.zrom.h eb-rom-list.h eb-roms.h *~

tools/firmware/etherboot/make-eb-rom-list +1 -1
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 set -e
 roms=$1; shift
 echo "/* autogenerated - do not edit */"

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
In reply to John Levon
Quoted 4 lines · On Friday 01 February 2008 19:21:03 John Levon wrote:
Quoted 1 line · John Levon

With the patch below (at least some of the way), I just get:

And the patch

See the bottom of this mail for comment.

Quoted 75 lines

john

config/StdGNU.mk +1 -0
@@ -12,6 +12,7 @@ SIZEUTIL   = $(CROSS_COMPILE)size
 
 MSGFMT     = msgfmt
 MSGMERGE   = msgmerge
+TAR        = tar
 
 INSTALL      = install
 INSTALL_DIR  = $(INSTALL) -d -m0755 -p
config/SunOS.mk +1 -0
@@ -11,6 +11,7 @@ SIZEUTIL   = $(CROSS_COMPILE)gsize
 SIZEUTIL   = $(CROSS_COMPILE)gsize
 
 MSGFMT     = gmsgfmt
+TAR        = gtar
 
 SHELL      = bash
 
(quoted diff) +0 -0

b/tools/firmware/etherboot/Makefile --- a/tools/firmware/etherboot/Makefile +++ b/tools/firmware/etherboot/Makefile

tools/firmware/etherboot/Makefile +5 -5
@@ -21,14 +21,14 @@ eb-%.zrom.h: $E/src/Config
 	mv -f [email protected] $@
 
 eb-rom-list.h: make-eb-rom-list $E/src/bin/Roms
-	./$^ $(NICS) >[email protected] && mv -f [email protected] $@
+	PATH=/usr/gnu/bin/:$(PATH) ./$^ $(NICS) >[email protected] && mv -f [email protected] $@
 
 eb-roms.h: eb-rom-list.h $(ROM_ZHS)
 	cat $^ >[email protected] && mv -f [email protected] $@
 
 $E/src/Config: $T Config
 	rm -rf $D $E
-	tar zxf $T
+	$(TAR) zxf $T
 	cat Config >>$D/src/Config
 	@
 	# override many of the settings in Config
@@ -36,14 +36,14 @@ eb-roms.h: eb-rom-list.h $(ROM_ZHS)
 	echo "HOST_CC=$(HOSTCC)" >>$D/src/Config
 	echo "CPP=$(CPP)" >>$D/src/Config
 	echo "CC=$(CC)" >>$D/src/Config
-	echo "AS=$(CC) -c -x assembler -" >>$D/src/Config
+	echo "AS=$(AS)" >>$D/src/Config
 	echo "LD=$(LD)" >>$D/src/Config
 	echo "SIZE=$(SIZE)" >>$D/src/Config
 	echo "AR=$(AR)" >>$D/src/Config
 	echo "RANLIB=$(RANLIB)" >>$D/src/Config
 	echo "OBJCOPY=$(OBJCOPY)" >>$D/src/Config
 	echo "CFLAGS+=$(CFLAGS)" >>$D/src/Config
-	echo "ASFLAGS+=$(CFLAGS)" >>$D/src/Config
+	echo "ASFLAGS+=$(ASFLAGS)" >>$D/src/Config
 	echo "LDFLAGS+=$(LDFLAGS_DIRECT)" >>$D/src/Config
 	@
 	set -e; cd $D/src/arch/i386; \
@@ -53,7 +53,7 @@ eb-roms.h: eb-rom-list.h $(ROM_ZHS)
 	mv $D $E
 
 $E/src/bin/Roms: $E/src/Config
-	$(MAKE) -C $E/src bin/Roms
+	PATH=/usr/gnu/bin/:$(PATH) $(MAKE) -C $E/src bin/Roms
 
 clean:
 	rm -rf $D $E *.zrom.h eb-rom-list.h eb-roms.h *~
(quoted diff) +0 -0

b/tools/firmware/etherboot/make-eb-rom-list ---
a/tools/firmware/etherboot/make-eb-rom-list
+++ b/tools/firmware/etherboot/make-eb-rom-list

tools/firmware/etherboot/make-eb-rom-list line 4

Quoted 5 lines
tools/firmware/etherboot/make-eb-rom-list +1 -1
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 set -e
 roms=$1; shift
 echo "/* autogenerated - do not edit */"

This is not ok for *BSD. bash is a third-party package there.

Christoph

Signature · 12 lines
AMD Saxony, Dresden, Germany
Operating System Research Center

Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
   Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
   AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
   Dr. Hans-R. Deppe, Thomas McCoy
#4 lore raw

Christoph Egger writes ("Re: [Xen-devel] getting etherboot compiling"):

Quoted 1 line

This is not ok for *BSD. bash is a third-party package there.

I think this is OK in a tool needed for building, surely ? After all you need GCC to build Xen and that's a third-party package in *BSD too.

However, it's a very simple script and I can't see anything in it which ought not to work (ie, I think it uses only features in SuSv3). What is the problem that means Solaris /bin/sh doesn't work ?

Ian.

#5 lore raw
Quoted 6 lines · On Monday 04 February 2008 16:52:56 Ian Jackson wrote:

Christoph Egger writes ("Re: [Xen-devel] getting etherboot compiling"):

Quoted 1 line

This is not ok for *BSD. bash is a third-party package there.

I think this is OK in a tool needed for building, surely ? After all you need GCC to build Xen and that's a third-party package in *BSD too.

GCC is in the base system. Install a BSD and have a look.

Quoted 3 lines

However, it's a very simple script and I can't see anything in it which ought not to work (ie, I think it uses only features in SuSv3). What is the problem that means Solaris /bin/sh doesn't work ?

Neither do I. It works with *BSD's /bin/sh.
However, Solaris /bin/sh is a much older bourne shell than on BSD.

Christoph

author
#6 lore raw
In reply to Ian Jackson
Quoted 10 lines · Ian Jackson

Christoph Egger writes ("Re: [Xen-devel] getting etherboot compiling"):

Quoted 1 line

This is not ok for *BSD. bash is a third-party package there.

I think this is OK in a tool needed for building, surely ? After all you need GCC to build Xen and that's a third-party package in *BSD too.

However, it's a very simple script and I can't see anything in it which ought not to work (ie, I think it uses only features in SuSv3). What is the problem that means Solaris /bin/sh doesn't work ?

It's the variable substitution command, not understand by the 'real' Bourne shell

regards
john

#7 lore raw

John Levon writes ("Re: [Xen-devel] getting etherboot compiling"):

Quoted 2 lines

It's the variable substitution command, not understand by the 'real' Bourne shell

You mean the ${...#...} construction in this line

         echo "  ETHERBOOT_ROM($nic,${makerom#*-p}) \\"

?

This is specified in SuSv3 Shell Command Language' section 2.6.2 Parameter Expansion', final part of the normative text.

Ian.

author
#8 lore raw
Quoted 7 lines · Ian Jackson

John Levon writes ("Re: [Xen-devel] getting etherboot compiling"):

Quoted 2 lines

It's the variable substitution command, not understand by the 'real' Bourne shell

You mean the ${...#...} construction in this line

         echo "  ETHERBOOT_ROM($nic,${makerom#*-p}) \\"

?

Yep.

Quoted 2 lines

This is specified in SuSv3 Shell Command Language' section 2.6.2 Parameter Expansion', final part of the normative text.

Original Bourne shell isn't SuSv3 (would be hard for that to be true :)

Such standards allow a system to provide a way of choosing to opt into them. On Solaris, that involves fiddling with the path to pick the standard variants (adding /usr/xpg4/bin would do it I think). This was because SuS and other standards are incompatible with various bits of historical behaviour.

regards
john

#9 lore raw

John Levon writes ("Re: [Xen-devel] getting etherboot compiling"):

Quoted 5 lines

Such standards allow a system to provide a way of choosing to opt into them. On Solaris, that involves fiddling with the path to pick the standard variants (adding /usr/xpg4/bin would do it I think). This was because SuS and other standards are incompatible with various bits of historical behaviour.

Well I think putting #!/usr/xpg4/bin/sh at the top of this script would work even less well. Is there an Official Sun Answer to what #! line should be put at the top of a portable SuSv3 shell script ? As far as I can tell everyone else uses #!/bin/sh for this.

As I say, you don't need to run it now anyway (since Keir has checked in the generated roms.h). Even so, if we have to break someone's attempts to build after hacking the roms, I'd rather break on where /bin/sh is prehistoric, which seems like an actual bug, rather than systems which don't have bash or maybe lack /bin/bash as a symlink.

Ian.

author
#10 lore raw
Quoted 9 lines · Ian Jackson

John Levon writes ("Re: [Xen-devel] getting etherboot compiling"):

Quoted 5 lines

Such standards allow a system to provide a way of choosing to opt into them. On Solaris, that involves fiddling with the path to pick the standard variants (adding /usr/xpg4/bin would do it I think). This was because SuS and other standards are incompatible with various bits of historical behaviour.

Well I think putting #!/usr/xpg4/bin/sh at the top of this script would work even less well.

Indeed.

Quoted 2 lines

Is there an Official Sun Answer to what #!
line should be put at the top of a portable SuSv3 shell script?

Not really. "/usr/bin/env sh" would be closest I suppose, assuming you've set up your environment as in standards(5) (that is, set PATH appropriately).

Quoted 1 line

As far as I can tell everyone else uses #!/bin/sh for this.

This is rarely true. Most commonly, this means "something that's kind of like the Bourne shell, but definitely not the Korn or C shell", and often "I actually mean bash".

Quoted 5 lines

As I say, you don't need to run it now anyway (since Keir has checked in the generated roms.h). Even so, if we have to break someone's attempts to build after hacking the roms, I'd rather break on where /bin/sh is prehistoric, which seems like an actual bug, rather than systems which don't have bash or maybe lack /bin/bash as a symlink.

Agreed.

regards,
john