Skip to contentSkip to conversation

Writing C program on Stubdom

DISCUSSION 阮安邦 2 participants 2 messages Dec 12, 2008

lore
Share & tools
lore

阮安邦

author
#0 lore raw

Hi, list!

Currently I am trying to write C programs on Stubdom. In my
understanding, the c-stubdom is trying to show us that we can just write standard C programs, linking it to mini-os,(with the APP_OBJS points to the appropriate obj files), then we can run the program as a separate Xen Domain, am I right?

I successfully compiled the c-stubdom ( by "make c-stubdom" in
XEN_ROOT/stubdom ), and i got the mini-os.gz. Does it mean that i can use it as a kernel to create a new domain, and what it would do is simply out put "hello wolrd" then hangs up? But i get the VMWare crash when i tried to do this. ( Yes, i deployed XEN 3.3 in VMware).

On the other hand, to find out how stubdom links applications (such
ioemu, grub) with MiniOS, I examined the Makefile in XEN_ROOT/stubdom, I noticed that it is achieved by passing "APP_OBJ= target objects" to the make command of miniOS. In the Makefile of MiniOS, I found the following scripts:

$(OBJ_DIR)/$(TARGET)_app.o: $(APP_OBJS) app.lds
$(LD) -r -d $(LDFLAGS) -\( $^ -\) $(APP_LDLIBS) --undefined main -o $@

Is the purpose of this scrpits to adjust the APP_OBJS according to
app.lds, so it can be linked to MiniOS?

then:

$(OBJ_DIR)/$(TARGET): links $(OBJS) $(OBJ_DIR)/$(TARGET)_app.o arch_lib

    $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(OBJ_DIR)/$(TARGET)_app.o $(OBJS)

$(LDARCHLIB) $(LDLIBS) -o [email protected]
$(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start [email protected] [email protected]

Above scripts replaces the "__attribute__((weak)) int
app_main(start_info_t *si)" within XEN_ROOT/Extra/Mini-os/Kernel.c with the adjusted APP_OBJS?

Thanks!

Signature · 2 lines
Regards!
Ryan

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

#1 lore raw

Hello,

Quoted 4 lines · 阮安邦, le Fri 12 Dec 2008 17:01:06 +0800, a écrit :

In my understanding, the c-stubdom is trying to show us that we can just write standard C programs, linking it to mini-os,(with the APP_OBJS points to the appropriate obj files), then we can run the program as a separate Xen Domain, am I right?

Yes.

Quoted 2 lines

Does it mean that i can use it as a kernel to create a new domain, and what it would do is simply out put "hello wolrd" then hangs up?

Yes.

Quoted 2 lines

But i get the VMWare crash when i tried to do this. ( Yes, i deployed XEN 3.3 in VMware).

You mean _VMWare_ crashes? Well that's our fault then :)

Quoted 5 lines

$(OBJ_DIR)/$(TARGET)_app.o: $(APP_OBJS) app.lds
$(LD) -r -d $(LDFLAGS) -\( $^ -\) $(APP_LDLIBS) --undefined main -o $@

Is the purpose of this scrpits to adjust the APP_OBJS according to
app.lds, so it can be linked to MiniOS?

Yes.

Quoted 8 lines

$(OBJ_DIR)/$(TARGET): links $(OBJS) $(OBJ_DIR)/$(TARGET)_app.o arch_lib

    $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(OBJ_DIR)/$(TARGET)_app.o $(OBJS) $

(LDARCHLIB) $(LDLIBS) -o [email protected]
$(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start [email protected] [email protected]

Above scripts replaces the "__attribute__((weak)) int app_main
(start_info_t *si)" within XEN_ROOT/Extra/Mini-os/Kernel.c with the adjusted APP_OBJS?

Yes, in order to replace the default "test" app_main of mini-os.

Samuel