Joe Bonasera wrote:
> Roland Mainz wrote:
> > Joe Bonasera wrote:
> >>> ... However I couldn't go any further. Any hints? For once, from the
> >>> usual /platform/.../unix grub
> >>> menu.lst entries I deduce that unix is the os kernel to be loaded by
> >>> grub, but as dboot is what grub
> >>> really understands, then dboot must somehow be embedded into unix, right?
> >> Yes - The magic mostly happens from the usr/src/uts/i86pc/unix Makefile --
> >>
> >> $(DBOOT_O): $(DBOOT_BIN)
> >> @echo " .data" > $(DBOOT_S)
> >> @echo " .globl dboot_image" >> $(DBOOT_S)
> >> @echo "dboot_image:" >> $(DBOOT_S)
> >> $(ELFEXTRACT) $(DBOOT_BIN) >> $(DBOOT_S)
> >> $(COMPILE.s) -o $(DBOOT_O) $(DBOOT_S)
> >
> > Ahhgllrrr... sorry for the offtopic rant...
> > ... but is anyone interested to sponsor a patch to cleanup such things,
> > e.g. turn the code above into
> > -- snip --
> > @ ( echo " .data" \
> > echo " .globl dboot_image" \
> > echo "dboot_image:" \
> > ) > "$(DBOOT_S)"
> > $(ELFEXTRACT) $(DBOOT_BIN)
> > -- snip --
> > , please (I've saw such stuff several times in OS/Net (see
> > http://mail.opensolaris.org/pipermail/shell-discuss/2007-June/000465.html
> > why the construct above is... uhm... not nice... ;-( )) ?
> >
>
> If the complaint is efficiency,
The idea was to get slightly cleaner and more efficient code (e.g. save
|fork()|+|exec()| (|fork()| is a heavywheight operation and |exec()|
requires crosscalls to all CPUs for addressspace teardown)).
> it's seems a pretty minor one. These
> rules are executed at most 4 times in a full debug+non-debug build.
Right... but I think that "one output redirection+build the file on one
step" is much cleaner than "doing lots of redirections to build the file
incrementally" ...
> I much prefer the simpler existing code. I'm not a shell or make
> expert and don't even understand w/o going to read through man pages
> how the 2nd set of code is equivalent. How does the output of ELFEXTRACT
> get into $(DBOOT_S) .. or did you only mean to change the echo lines?
Erm, I simply missed the " $(ELFEXTRACT) $(DBOOT_BIN)"-line... sorry...
...the code should look like this:
-- snip --
@ ( echo " .data" ; \
echo " .globl dboot_image" ; \
echo "dboot_image:" : \
$(ELFEXTRACT) $(DBOOT_BIN) ; \
) > "$(DBOOT_S)"
$(ELFEXTRACT) $(DBOOT_BIN)
-- snip --
from the viewpoint of performace this currently doesn't save much (e.g.
you save lots of |open()|+|close()| calls) ... but if you use ksh you
can replace the "echo" statements with "print" (which is like "echo"
except that it is a ksh builtin command and therefore saves the
|fork()|+|exec()|) and use a block (e.g. "{ ... ; }" instead of a
subshell (e.g. "( ... )") which saves another |fork()|.
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) [EMAIL PROTECTED]
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 7950090
(;O/ \/ \O;)
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code