> ... 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)
This takes the stand alone 32 bit program and turns it into a binary blob
for embedding into the dboot section of 32 or 64 bit unix. You'll find
elfextract in usr/src/tools.
Then the rule to build unix:
$(UNIX_BIN): $(UNIX_O) $(MODSTUBS_O) $(MAPFILE_NAME) \
$(GENLIB) $(DTRACESTUBS) $(DBOOT_O)
$(LD) -dy -b -o $@ -e dboot_image -znointerp -M $(MAPFILE_NAME) \
$(UNIX_O) $(DBOOT_O) $(MODSTUBS_O) $(LIBOPTS) \
$(DTRACESTUBS)
$(MBH_PATCH) $(UNIX_BIN)
$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
$(POST_PROCESS)
The mapfiles are in usr/src/uts/i86pc/conf and arrange for the dboot binary
blob to be in its own PT_LOAD section in the elf file. mbh_patch fixes
up the multiboot header image fields once the final 64 bit unix ELF is all done
linking.
To get from dboot into the rest of unix, dboot turns on virtual memory
and jumps to the kernel entry point which is always just the first instruction
at the load address of the kernel text. That's always i86pc/ml/locore.s - which
starts with:
/*
* The very first thing in the kernel's text segment must be a jump
* to the os/fakebop.c startup code.
*/
.text
jmp _start
You'll find _start written in C in usr/src/uts/i86pc/fakebop.c.
>From there on out it's mostly written in C and not too hard to
follow.
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code